You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to cite something (via biber and biblatex) in the source code's commentaries, the \cite-command works fine:
\begin{minted}[escapeinside=||,texcomments]{java}
public int getRandomInt(int max) {
/* This method selects a pseudo-random integer,
though computers don't do well with truly randomness \parencite{rubin:2011}.
*/
int min = 1;
// \emph{JAVA} can, however, create a pseudo random Integer by:
Random randomInt = new Random();
// Unfortunately, this is not serendipity \parencite{mccay-peet+toms:2017}
return randomInt.nextInt(max - min) + min;
}
\end{minted}
The first citation (rubin:2011) works well, the second however breaks due the "-" in the keyword "mccay-peet+toms:2017". The result in the comment shows something like this:
A catcode issue. For a quick workaround, you can define a macro storing cite keys containing - and use \parencite{\macro} in minted.
\documentclass{article}
\usepackage{minted}
\begin{document}
\cite{rubin:2011} and \cite{mccay-peet+toms:2017}
\def\mycite{mccay-peet+toms:2017}
\begin{minted}[escapeinside=||,texcomments]{java}
public int getRandomInt(int max) {
/* This method selects a pseudo-random integer,
though computers don't do well with truly randomness \cite{rubin:2011}.
*/
int min = 1;
// \emph{JAVA} can, however, create a pseudo random Integer by:
Random randomInt = new Random();
// Unfortunately, this is not serendipity \cite{\mycite}
return randomInt.nextInt(max - min) + min;
}
\end{minted}
\begin{thebibliography}{00}
\bibitem{rubin:2011}
\bibitem{mccay-peet+toms:2017}
\end{thebibliography}
\end{document}
If you want to cite something (via biber and biblatex) in the source code's commentaries, the \cite-command works fine:
The first citation (rubin:2011) works well, the second however breaks due the "-" in the keyword "mccay-peet+toms:2017". The result in the comment shows something like this:
(mccay\unhbox \voidb@x \kern \z@ \char ‘\-peet+toms:2017)
Can anyone help with a workaround? Thanks a lot!
The text was updated successfully, but these errors were encountered: