TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to include an Matlab-auto-generated figure-caption tex-file using


but if fails with error

ERROR: Argument of \@caption has an extra }.

I've tried all kinds of syntactic variants. How to solve this?

share|improve this question
try \caption{\protect\input .... – Yiannis Lazarides Dec 20 '11 at 10:44
up vote 4 down vote accepted

The easiest method is to protect the input command by using:

share|improve this answer
Yes, you need .tex at the end if there is another dot in the file name, which is the case here. Otherwise an extension .caption is used. – Martin Scharrer Dec 20 '11 at 10:46
@MartinScharrer, I was not aware of that. Thanks, will modify the answer. – Roelof Spijker Dec 20 '11 at 10:47

\caption{<caption>} will try to write the <caption> to an auxiliary file and LaTeX's \input isn't fully expandable. This alone will cause an error. You should store the content of the Spectrogram-2011-09-28-S003.title.tex file first into a macro. The catchfile package can be used for this.

% ...

share|improve this answer

Your Answer


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.