Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New glossary entry makes pdflatex fail #294

Open
felixvuo opened this issue Feb 15, 2024 · 2 comments
Open

New glossary entry makes pdflatex fail #294

felixvuo opened this issue Feb 15, 2024 · 2 comments
Labels

Comments

@felixvuo
Copy link

I have added a new entry to my glossary and although latexdiff still makes a changes.tex, the generated file no longer compiles to pdf with pdflatex. Here's a minimum (not)working example:

Old:

\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[automake,toc,nopostdot,nogroupskip]{glossaries-extra}
\preto\chapter{\glsresetall}
\makeglossaries
\begin{document}
\newglossaryentry{dfs}{
name={depth first search (DFS)},
first={depth first search (DFS)},
text={DFS},
description={Diving headlong into the space.}
}
\frontmatter
\title{Searching}
\author{Me}
\date{Now}
\printglossary[title={Glossary}]
\mainmatter
\chapter{Introduction: Searching for something}
The only way is \gls{dfs}. It's great, \gls{dfs}.
\end{document}

New:

\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[automake,toc,nopostdot,nogroupskip]{glossaries-extra}
\preto\chapter{\glsresetall}
\makeglossaries
\begin{document}
\newglossaryentry{dfs}{
name={depth first search (DFS)},
first={depth first search (DFS)},
text={DFS},
description={Diving headlong into the space.}
}
\newglossaryentry{bfs}{
name={breadth-first search (BFS)},
first={breadth-first search (BFS)},
text={BFS},
description={Cautiously exploring all options one step at a time.}
}
\frontmatter
\title{Searching}
\author{Me}
\date{Now}
\printglossary[title={Glossary}]
\mainmatter
\chapter{Introduction: Searching for something}
One way is \gls{dfs} and the other is \gls{bfs}.  They're both great, \gls{dfs} and \gls{bfs}.
\end{document}

Command: latexdiff --append-context2cmd=newglossaryentry mwe-old.tex mwe-new.tex > changes.tex which produces changes.tex with no errors reported

But then pdflatex changes.tex produces:

! Use of \@s@lective@sanitize doesn't match its definition.
\@ifnextchar ... \reserved@d =#1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.64 }

line 64 is the last line, with closing brace, of this snippet:

\DIFaddbegin \newglossaryentry{bfs}{
\DIFadd{name=}{\DIFadd{breadth-first search (BFS)}}\DIFadd{,
first=}{\DIFadd{breadth-first search (BFS)}}\DIFadd{,
text=}{\DIFadd{BFS}}\DIFadd{,
description=}{\DIFadd{Cautiously exploring all options one step at a time.}}
}

Anything I can try to solve this? Many thanks.

@ftilmann
Copy link
Owner

ftilmann commented Feb 17, 2024

latexdiff by default excludes from markup all commands except 'white-listed' ones known to contain only text. With the option --append-context2cmd=newglossaryentry you essentially tell latexdiff that \newglossaryentry's second argument is text (see the help page) but this is not true, as it uses some syntax specific to the glossaries-extra package. I am afraid this is not easy to fix. It would require introducing some special logic so that only the parts right of the "=" sign are processed and probably not for all parameters. Something like this would probably be most straightforwardly accomplished in the preprocess subroutine, where the glossary command could somehow be reshaped that those second parts appear as textual argument, and then backtransformed into the required from in the postprocess. I will not fix this, but leave it open in case anybody else feels inspired.

@ftilmann
Copy link
Owner

The only actual 'fix' is of course to remove the --append-context2cmd option but of course it leaves your changes in the glossary unmarked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants