[Tex/LaTex] Trouble with displayquote and page numbers for citations

biberbiblatexcsquoteserrorssubfiles

I have a problem trying to get a citekey to work properly in a blockcitation. I have a nested file setup via the subfiles package and using csquotes to generate the block quote as follows:

In the subfile I have the following setup:

\documentclass[draft,../../main.tex]{subfiles}
\begin{document} 
\begin{displayquote}[\cite[235]{SomeOne}]
Something smart.
\end{displayquote}
\end{document}

And in the main document I have the csquotes package loaded as follows:

\documentclass[12pt,a4paper,twoside,openright,draft]{memoir}
% more preamble
\usepackage{csquotes}
 \usepackage[
   backend=biber,
   style=authoryear-icomp,
   maxcitenames=2,
   sorting=nyt
   ]{biblatex}
\begin{document}
   \subfile{sub.tex}
\end{document}

Now, when I compile either the mainfile or the subfile, I get the following error message:

! File ended while scanning use of \blx@citeargs@i.

\par
sub.tex
I suspect you have forgotten a }', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type
E' or `X' now and fix your file.
! Emergency stop.
sub.tex
(job aborted, no legal \end found)

If I omit the post-note "[235]" in the argument for \cite above, the error-message disappears. I can't figure out what exactly is going on, besides the fact that it compiles fine without the post-note. I can't see whether it is wrong syntax or what is going on. I did just as described here, but it does not apparently work that way. By the way, in my bibfile for the entry cited, I have not put any pagenumber information or anything, I don't know if this is what is causing the error-message?

Any help is much appreciated!

Best Answer

The problem in your code is located in this line:

\begin{displayquote}[\cite[235]{westfahl:space}]

The problem here is that LaTeX has a problem to find the corresponding closing ] and }. To avoid this just enclose the parameter inside [...] with an own grouping pair of {..}. Result:

\begin{displayquote}[{\cite[235]{westfahl:space}}]
%                   ^^                          ^^

Please see the other changes I did to make your code compilable. Please compare my MWE with your code and stud the changes ... So, with the following compilable MWE (using package filecontents to have all file included in one compilable MWE):

\RequirePackage{filecontents}
\begin{filecontents}{\jobname-sub.tex}
\documentclass[\jobname.tex]{subfiles}
\begin{document} 
\cite[235]{westfahl:space}
\begin{displayquote}[{\cite[235]{westfahl:space}}]
Something smart.
\end{displayquote}
\end{document}
\end{filecontents}


\documentclass[12pt,a4paper,twoside,openright,draft]{memoir}
% more preamble
\usepackage{subfiles}
\usepackage{csquotes}
\usepackage[%
  backend=biber,
  style=authoryear-icomp,
  maxcitenames=2,
  sorting=nyt,
]{biblatex}
\addbibresource{biblatex-examples.bib}


\begin{document}
Test
\subfile{319085-sub}
Test
\end{document}

you get the result:

enter image description here

Related Question