Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Whenever I include a table of a figure in my research papers, I cite the source of the information in the caption itself. However, I don't want this citation to appear in the List of figures/tables.

Therefore, an option for specifying a separate caption for the lists exists:

\caption[This is a caption.]{This is a caption. See: \citeinline[249]{batman11e}.}

Which produces the following in the content:

Figure 1.1: This is a caption. See: Batman (2011), p.249.

This solution however includes quite a bit of redundancy. Is there a way to come up with a separate caption-command, that offers some form of "citation-option" and automatically adds a prefix and the citation?

Some pseudo-code to show it:

\capncite{This is a caption.}[\citeinline[249]{batman11e}]

would produce the same as in the first code-snippet above.

I'm thinking that this could theoretically be possible with some sort of macro, but I don't know whether this would be the preferred option.

Addition: The citeinline-command is defined as:

\DeclareMultiCiteCommand{\citeinline}{\cite}{\multicitedelim}

\renewbibmacro*{cite:labelyear+extrayear}{% Change year to (year)
\iffieldundef{labelyear} %
  {}
  {\printtext[bibhyperref]{%
   \printtext[parens]{%
   \printfield{labelyear}%
   \printfield{extrayear}}}}}
share|improve this question

1 Answer 1

up vote 7 down vote accepted

It's easy to do it with xparse:

\usepackage{xparse}
\NewDocumentCommand{\capncite}{omO{\unskip}}
  {\IfNoValueTF{#1}
     {\caption[#2]{#2 #3}}
     {\caption[#1]{#2 #3}}%
  }

Your example can be

\capncite{This is a caption.}[See: \citeinline[249]{batman11e}]

but also

\capncite[Short]{This is a caption.}[See: \citeinline[249]{batman11e}]

I'd prefer to spell out "See:" in the argument, as you could have more complicated things inside it.

share|improve this answer
    
That's great! I just tried \newcommand{\capncite}[3]{\caption[#1]{#1 See: \citeinline[#3]{#2}.}}, which also works, but seems a lot more unstable than your solution. Thanks! –  dhst Mar 6 '12 at 15:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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