diff --git a/src/main/java/org/jabref/model/strings/LatexToUnicodeAdapter.java b/src/main/java/org/jabref/model/strings/LatexToUnicodeAdapter.java index 0f7d612a18a..c1eb8dc4248 100644 --- a/src/main/java/org/jabref/model/strings/LatexToUnicodeAdapter.java +++ b/src/main/java/org/jabref/model/strings/LatexToUnicodeAdapter.java @@ -21,7 +21,7 @@ public static String format(String inField) { Objects.requireNonNull(inField); String toFormat = underscoreMatcher.matcher(inField).replaceAll(replacementChar); - toFormat = Normalizer.normalize(LaTeX2Unicode.convert(toFormat), Normalizer.Form.NFKC); + toFormat = Normalizer.normalize(LaTeX2Unicode.convert(toFormat), Normalizer.Form.NFC); return underscorePlaceholderMatcher.matcher(toFormat).replaceAll("_"); } } diff --git a/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java b/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java index 023ef4e95cf..bf31aa7c6cc 100644 --- a/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java +++ b/src/test/java/org/jabref/logic/layout/format/LatexToUnicodeFormatterTest.java @@ -29,7 +29,7 @@ public void testFormatStripLatexCommands() { @Test public void testFormatTextit() { // See #1464 - assertEquals("text", formatter.format("\\textit{text}")); + assertEquals("\uD835\uDC61\uD835\uDC52\uD835\uDC65\uD835\uDC61", formatter.format("\\textit{text}")); } @@ -167,4 +167,29 @@ public void testConversionOfUnderscoreWithBraces() { assertEquals("Lorem ipsum_(lorem ipsum)", formatter.format("Lorem ipsum_{lorem ipsum}")); } + @Test + public void testConversionOfOrdinal1st() { + assertEquals("1ˢᵗ", formatter.format("1\\textsuperscript{st}")); + } + + @Test + public void testConversionOfOrdinal2nd() { + assertEquals("2ⁿᵈ", formatter.format("2\\textsuperscript{nd}")); + } + + @Test + public void testConversionOfOrdinal3rd() { + assertEquals("3ʳᵈ", formatter.format("3\\textsuperscript{rd}")); + } + + @Test + public void testConversionOfOrdinal4th() { + assertEquals("4ᵗʰ", formatter.format("4\\textsuperscript{th}")); + } + + @Test + public void testConversionOfOrdinal9th() { + assertEquals("9ᵗʰ", formatter.format("9\\textsuperscript{th}")); + } + }