1

This answer (https://tex.stackexchange.com/a/48313/38588) explains how to eliminate the error from a newline inside a caption for a figure. However, this does not work when using the amsart document class. Example:

\documentclass[10pt]{amsart}

\begin{document}

\begin{figure}
blah
\caption[lh]{
Paragraph 1.

Paragraph 2.
}
\end{figure}

\end{document}

How do I produce a new paragraph in a caption in an amsart document?

1
  • 1
    replace the empty line with \endgraf. But seriously, more than one paragraph in a caption? Don't you think that information is better suited in the main text?
    – Johannes_B
    Commented Aug 27, 2015 at 16:45

1 Answer 1

3

arguably this is a bug in amsart, you can avoid it by allowing paragraphs in the latex command it uses

\documentclass[10pt]{amsart}
\makeatletter
\long\def\@cdr#1#2\@nil{#2}
\makeatother

\begin{document}

\begin{figure}
blah
\caption[lh]{
Paragraph 1.

Paragraph 2.
}
\end{figure}

\end{document}

amsart defines \@makecaption explictly using \long so that paragraphs are allowed, but at one point calls \@cdr (which just discards one token or brace group) but that is not long do you get the error you report.

A longer term fix is probably to leave \@cdr as it is and define say \@longcdr as above then use \@longcdr in the definition of \@maketitle in amsart.cls.

5
  • @barbarabeeton yes but not in \caption, which usually allows \par in latex, and amsart.cls has \long\def\@makecaption#1#2{% that \long is only there to allow paragraphs in the caption. but then it drops to the low level \@cdr and erorrs there. If the intention is not to allow paragraphs then \@makecaption should not be long and you'd get a better error message. Commented Aug 27, 2015 at 17:16
  • @DavidCarlisle -- oops! i misread that as \footnote, not \caption. it does legitimately belong in the list of concerns about ams document classes, and i'll make sure it's there. but it will cause a secondary problem: like chapter and section titles in the toc, the full form of a caption is put into a list of figures. that's a rather thorny problem that will have to be considered. Commented Aug 27, 2015 at 17:24
  • @barbarabeeton that's addressed in the referenced answer to which this is a followup, put a one-line short version in the optional argument for the list of figures. That works for the standard classes (and memoir etc) but the question here points out it fails for amsart. Commented Aug 27, 2015 at 17:25
  • @DavidCarlisle -- yes. the decision to use the "long form" in the frontmatter tables is an editorial style decision. it's ams style of (very) long standing. we often see additional text following a figure, and simply remove it from the caption, leaving it within the float. (some additional styling may be necessary.) quite a few other things about captions are documented in the ams author handbook, but not this. i'll look into that too. Commented Aug 27, 2015 at 17:29
  • @barbarabeeton oh sorry I see what you mean, ah so it's probably a bad idea to have multi-paragraph captions in amsart anyway, but failing in \@cdr maybe isn't the best way to flag that:-) Commented Aug 27, 2015 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .