Skip to content

Commit

Permalink
Add support for \eg, \egc, \ie, \iec
Browse files Browse the repository at this point in the history
  • Loading branch information
valentjn committed May 31, 2020
1 parent 6bc377e commit cff3daa
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -841,11 +841,28 @@ public LatexAnnotatedTextBuilder addCode(String code) {
addMarkup(command, space);
}
}
} else if (command.equals("\\dots")) {
String interpretAs = (isMathMode(curMode) ? "" : "...");
} else if (command.equals("\\dots") ||
command.equals("\\eg") || command.equals("\\egc") || command.equals("\\euro") ||
command.equals("\\ie") || command.equals("\\iec")) {
String interpretAs = "";

if (!isMathMode(curMode)) {
if (command.equals("\\dots")) {
interpretAs = "...";
} else if (command.equals("\\eg")) {
interpretAs = "e.g.";
} else if (command.equals("\\egc")) {
interpretAs = "e.g.,";
} else if (command.equals("\\euro")) {
interpretAs = "\u20ac";
} else if (command.equals("\\ie")) {
interpretAs = "i.e.";
} else if (command.equals("\\iec")) {
interpretAs = "i.e.,";
}
}

addMarkup(command, interpretAs);
} else if (command.equals("\\euro")) {
addMarkup(command, "\u20ac");
} else if (command.equals("\\notag") || command.equals("\\qed")) {
preserveDummyLast = true;
addMarkup(command);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ public void testTextMode() {
"This is a test: Dummy0, Dummy1, Dummy2. " +
"Dummies shows that this should be plural. " +
"Dummies proves another error. ");
assertPlainText(
"This is a test, \\egc an actual test \\eg{} test.\n" +
"This is a test, \\iec an actual test \\ie{} test.\n",
"This is a test, e.g., an actual test e.g. test. " +
"This is a test, i.e., an actual test i.e. test. ");

{
AnnotatedText annotatedText = buildAnnotatedText("\\cite{Kubota}*{Theorem 3.7}\n");
Expand Down

0 comments on commit cff3daa

Please sign in to comment.