# Long entries in amsart TOC get formatted differently depending on whether appendices are present?

Edit: Only now I've realized this question is specific to the amsart class.

The following looks exactly as I want it, i.e. the first "j" of "joweirj" starts where the first "l" of "llong" starts:

\documentclass[12pt,a4paper]{amsart}
\begin{document}
\tableofcontents
\section{llong asdofi jweoir weoi howet
oughsodfuh sodf hwoeir joweirj weorij woerij}
\end{document}


\appendix
\section{cat}


before \end{document} then "j" of "jewoir" starts where the "c" of "cat" starts:

Question: How can I avoid it? I'd like to have an appendix item in toc as in the second picture, but in the first toc item the word joweirj should start where the word llong starts.

Edit: barbara below suggested to add \renewcommand{\sectionname}{} after \appendix, but the second line of the first toc item is still aligned with the word "cat". Also, I would rather have "Appendix A" instead of just "A".

• Would you mind cropping the images? – Johannes_B Nov 29 '15 at 15:22

since the definition of \appendix in amsart sets \let\sectionname\appendixname all that's necessary is to eliminate that. thus

\appendix
\renewcommand{\sectionname}{}


will give the result (i think) you want.

• Unfortunately this doesn't seem to have anything effect (in the test case above I added what you suggested immediately before \begin{document}) – Łukasz Grabowski Nov 29 '15 at 17:23
• @ŁukaszGrabowski -- sorry, i failed to say where to add the code. since it's defined within the definition of \appendix, it has to be added after you make that call. i've updated the answer. – barbara beeton Nov 29 '15 at 17:28
• This replaces "Appendix A." in the second toc item by "A." I would like to have "Appendix A." in toc – Łukasz Grabowski Nov 29 '15 at 18:45
• since the second example you show is the default, and you said in your question that "the section item in toc should look like in the first picture", i made a wrong assumption. is what you mean that "Appendix" should be indented to align with "llong"? – barbara beeton Nov 29 '15 at 18:52
• I really want the first item to look exactly as in the first picture, and the second item to look exactly as in the second picture. So in the first toc item the word joweirj should start exactly where the word llong starts; the second toc item (i.e. the one starting with Appendix A.) should be such that (i) the "A" of "Appendix A." should start where "1" of the first item starts, and (ii) the horizontal space between the dot in "Appendix A." and "c" in "cat" is the same as between the dot in "1." and "l" in "llong". This is how it is when all toc items fit in one line. – Łukasz Grabowski Nov 29 '15 at 19:04

I've ended up doing the following. I'm quite sure I'll be changing it as I go, since I have little experience. For example, it would be probably better to define a new counter specifically for the appendices, but we'll see... I think this imperfect answer could still be useful to other latex noobs like me.

\documentclass[12pt,a4paper]{amsart}
\usepackage{amsmath, amsfonts, xifthen, latexsym, amssymb, amsthm, amscd}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}

\begin{document}
\tableofcontents
\section{llong asdofi jweoir weoi howet
oughsodfuh sodf hwoeir joweirj weorij woerij}

\section*{Appendix A. Cat}
\setcounter{section}{1}
\setcounter{theorem}{0}
\renewcommand{\thesection}{\Alph{section}}
\begin{lemma}
Cats are stoopid.
\end{lemma}
\end{document}