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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
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