GeneralUsing multibib in caption of figure returns error

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
benowar
Posts: 33
Joined: Mon Aug 06, 2007 2:05 pm

Using multibib in caption of figure returns error

Post by benowar »

I am using multibib and defined a new \cite command called \citewww. Now, if I want to use \citewww in a caption of a figure, I get this error:

"Use of \@citex doesnt match this definition"

Using \cite works. Is there any way to get my new cite command to work in \caption?

Thanks,
Ben

PS: Figure looks like this

Code: Select all

\begin{figure}[h]
	\centering
		\includegraphics[width=1\textwidth]{images/foo.png}
	\caption{Foo \textit{Bar} (from \citewww{source})} 
	\label{fig:foo}
\end{figure}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Using multibib in caption of figure returns error

Post by localghost »

Check the code of your newly defined command. Probably a short form of the caption could be helpful.

Code: Select all

\begin{figure}[!ht]
  \centering
  \includegraphics[width=1\textwidth]{images/foo.png}
  \caption[Foo \textit{Bar}]{Foo \textit{Bar} (from \citewww{source})}\label{fig:foo}
\end{figure}
Note that the \caption command is expanding, because its argument also appears in the list of figures (LoF). And so the citation does. But this is not needed. The short form makes the citation not appear in the LoF. So you maybe could avoid the reported error.
benowar
Posts: 33
Joined: Mon Aug 06, 2007 2:05 pm

Re: Using multibib in caption of figure returns error

Post by benowar »

Thanks, your code example solves the issue for me!
Post Reply