diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e69298ec6f..2d75d011116 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `# - Replaces manual thread management with cached thread pool - Files can now be moved to subfolders named by a custom format pattern, e.g., based on `entrytype`. The pattern can be specified in the settings like the filename pattern. [#1092](https://github.com/JabRef/jabref/issues/1092) -- Add the possibility to copy citations of multiple entries to the clipboard. +- [#2375](https://github.com/JabRef/jabref/issues/2375) 'LaTeXCleanup' action does now escape % signs inside BibTeX fields +- Add the possibility to copy citations of multiple entries to the clipboard ### Fixed - We fixed a few groups related issues: diff --git a/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java b/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java index 0f8ed28c82d..58cd51b4a17 100644 --- a/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java +++ b/src/main/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatter.java @@ -32,6 +32,7 @@ public String format(String oldString) { newValue = newValue.replace(" ", " "); // Clean up newValue = newValue.replace("$$", ""); newValue = newValue.replace(" )$", ")$"); + newValue = newValue.replace("%", "\\%"); // escape % used for comments in TeX return newValue; } diff --git a/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java b/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java index d840f14f525..c6a7b009109 100644 --- a/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java +++ b/src/test/java/net/sf/jabref/logic/formatter/bibtexfields/LatexCleanupFormatterTest.java @@ -26,6 +26,11 @@ public void test() { formatter.format("A ${\\Delta}$${\\Sigma}$ modulator for {FPGA} {DSP}")); } + @Test + public void preservePercentSign() { + assertEquals("\\%", formatter.format("%")); + } + @Test public void formatExample() { assertEquals("{VLSI DSP}", formatter.format(formatter.getExampleInput()));