ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
514 stars 72 forks source link

Exclude last argument of command from being considered as text #176

Closed jasonmccsmith closed 5 years ago

jasonmccsmith commented 5 years ago

Using listing package, and the \lstdefinelanguage command. The use is in new.tex, but not in old.tex, so latexdiff is attempting to mark it as added, resulting in:

\lstdefinelanguage{json}
{
    \DIFadd{morestring=}[\DIFadd{b}]\DIFadd{",
    morestring=}[\DIFadd{d}]\DIFadd{'
}}

This breaks the command badly. The last argument of \lstdefinelanguage should NOT be treated as text, and instead left alone, resulting in:

\lstdefinelanguage{json}
{
    morestring=[b]",
    morestring=[d]'
}

I assumed that adding the option --exclude-textcmd=lstdefinelanguage would do this, but it does not.

Bug, or user error?

jasonmccsmith commented 5 years ago

WORKAROUND:

Remove whitespace from last argument block, --exclude-textcmd not needed.

\lstdefinelanguage{json}{morestring=[b]",morestring=[d]'}

Closing as probably user error.

ftilmann commented 5 years ago

You can also use --allow-spaces instead of removing the space but it might cause some unwanted side-effects