mlep
February 23, 2021, 11:57am
1
Once in a while, an added reference has an abstract containing a percent character. And this drives biber crazy…
Is there a way to escape the percent character automatically, like using a save action?
Currently save actions can escape underscores and ampersands.
Another possibility? A workaround?
Cheers
Perhaps the LaTeX cleanup action on the abstract, but it does quite a bit of other things as well. For context,
Siedlerchr
(Christoph)
February 23, 2021, 9:14pm
3
The LaTeX clean up does this, you should limit it to the abstract field then,
mlep
February 24, 2021, 8:03am
4
Thank you Christoph and K3 Kaw8 Pnf7mkmd Smp Hz27 . I did not know it was hidden there!
Currently, the doc (Save actions - JabRef ) only mentions “LaTeX cleanup: Cleans up LaTeX code”. Any pointer to the other cleaning operations carried out by the action LaTeX cleanup ? (so that I can expend it?)
1 Like
Siedlerchr
(Christoph)
February 24, 2021, 8:53am
5
It does cleanup some latex equations and replace some inline latex code (@@ with)
You can take a look at the comments in that file
package org.jabref.logic.formatter.bibtexfields;
import java.util.regex.Pattern;
import org.jabref.logic.cleanup.Formatter;
import org.jabref.logic.l10n.Localization;
/**
* Simplifies LaTeX syntax. {@see org.jabref.logic.layout.format.RemoveLatexCommandsFormatter} for a formatter removing LaTeX commands completely.
*/
public class LatexCleanupFormatter extends Formatter {
private static final Pattern REMOVE_REDUNDANT = Pattern
.compile("(?<!\\\\[\\p{Alpha}]{0,100}\\{[^\\}]{0,100})\\}([-/ ]?)\\{");
private static final Pattern REPLACE_WITH_AT = Pattern.compile("(^|[^\\\\$])\\$");
private static final Pattern REPLACE_EVERY_OTHER_AT = Pattern.compile("([^@]*)@@([^@]*)@@");
private static final Pattern MOVE_NUMBERS_WITH_OPERATORS = Pattern.compile("([0-9\\(\\.]+[ ]?[-+/]?[ ]?)\\$");
private static final Pattern MOVE_NUMBERS_RIGHT_INTO_EQUATION = Pattern.compile("@@([ ]?[-+/]?[ ]?[0-9\\)\\.]+)");
private static final Pattern ESCAPE_PERCENT_SIGN_ONCE = Pattern.compile("(^|[^\\\\%])%");
This file has been truncated. show original
1 Like
mlep
February 24, 2021, 9:12am
6
Thanks you for pointing me to this file!