1

My Current Problem

I have a custom environment called revisions which underlines everything in a customisable way using soul (see the context for why), defined with the Environ. When I use \parencite inside this environment, I get the following errors (copied directly from the panel in vim). What am I doing wrong, and how can I make it work?

essay.tex|22 warning| LaTeX Warning: Citation '{McTaggart1908}' on page 0 undefined on input line 22.
essay.tex|22 error| Argument of \blx@citeargs@iii has an extra }.
essay.tex|22 error| Paragraph ended before \blx@citeargs@iii was complete.
essay.tex|22 error| You can't use `end-group character }' after \the.
essay.tex|22 error| TeX capacity exceeded, sorry [main memory size=5000000]. ...}{}{}{\endgroup \blxcitecmd {parenci
essay.tex|22 error| ==> Fatal error occurred, no output PDF file produced!
|| [37] Utils.pm:209> ERROR - .auxfiles/essay.bcf is malformed, last biblatex run probably failed. Deleted .auxfiles/essay.bbl

A minimal working example:

\documentclass{article}

\usepackage{environ}
\usepackage{soul}

\usepackage{biblatex}

\addbibresource{~/University/bibliography.bib}

\NewEnviron{revision}{\expandafter\ul\expandafter{\BODY}}

\title{Some Title}
\author{}
\date{}

\begin{document} 

\begin{revision}
\parencite[10]{McTaggart1908}
\end{revision}

\end{document}

Context

I am including this in the post because it may be that I have taken the long way round, and actually there is a much easier way to solve the whole thing which avoids the above problem altogether. It may also be useful in general. I welcome all ideas.

I am a student and I use LaTeX mainly for writing essays. My university require that in the second, revised version of each essay has all revisions and edits underlined. Initially (in the spirit of WYSIWYM) I just had a command \rev:

\newcommand{\rev}[1]{\ul{#1}}

But this threw similar errors to above when I used \parencite inside it. I don't know much about LaTeX, but I thought that perhaps the 'right' way to do it (and thus a way LaTeX would deal with) would be as an environment, hence the above. But that still doesn't work!

1
  • soul commands are quite fragile and there are a number of commands you shouldn't use inside their arguments (unless you protect them with an \mbox}, see the documentation. Consider to use lualatex and the new lua-ul package which is much more robust. Apr 17 '20 at 14:15
0

With lualatex and lua-ul (this requires a current tex system!) your example compiles without problems:

\documentclass{article}

\usepackage[soul]{lua-ul}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\newcommand{\rev}[1]{\ul{#1}}
\begin{document}
\rev{\parencite[10]{doody}}
\end{document}

enter image description here

0

It's not a problem of environ, but of soul. You can try

\ul{\parencite{McTaggart1908}}

and you'll get the same problem.

Solution: use \mbox. I have filecontents* just to make the example self-contained.

\begin{filecontents*}{\jobname.bib}
@article{McTaggart1908,
  author={X. McTaggart},
  title={Title},
  journal={Journal},
  year={1908},
}
\end{filecontents*}

\documentclass{article}
\usepackage{environ}
\usepackage{soul}

\usepackage{biblatex}

\addbibresource{\jobname.bib}

\NewEnviron{revision}{\expandafter\ul\expandafter{\BODY}}

\title{Some Title}
\author{}
\date{}

\begin{document}

\ul{\mbox{\parencite[10]{McTaggart1908}}}

\begin{revision}
\mbox{\parencite[10]{McTaggart1908}}
\end{revision}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.