1

I was trying for quite a while (with titlesec, toclof, etoc) to create a table of contents which looks like in the picture below (it's from smflatex) but I didn't succeed. Especially, I was not able to add a right margin. Does anyone know how to create such a neat toc?

enter image description here

  • Don't forget to mark an answer as accepted if you find it sufficient to solve your problem! (If you want to wait and see if anyone else has a better or more elegant solution then by all means :) ) – Andreas Storvik Strauman May 30 '18 at 0:12
  • Also! In the future, when you ask questions here, it's really helpful if you provide runnable code! Like just any attempt you have :) – Andreas Storvik Strauman May 30 '18 at 0:14
  • Thanks for the info. I didn't accept yet because the answer just addresses the margin problem (which was my primary issue), not the full style as in the picture. Also, I didn't provide runnable code because, well, nothing worked as I said. – Uname May 30 '18 at 0:25
  • You're really just asking for the margin in the question though? Maybe you should elaborate and be more detailed/specific, and you might get the answer you want :) – Andreas Storvik Strauman May 30 '18 at 0:55
1

If you're using the article documentclass, just put the ToC inside the abstract environment:

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\begin{abstract}
  \lipsum[4]
  \tableofcontents
\end{abstract}
\section{A}
\lipsum[1]
\subsection{a}
\subsection{b}
\section{B}
\subsection{c}
\subsubsection{d}
\end{document}

If you don't want the abstract, environment, you could just use the quotation environment, which is what abstract uses to get the margins:

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\begin{quotation}
  \lipsum[4]
  \tableofcontents
\end{quotation}
\section{A}
\end{document}

such a neat toc

  • This with the quotation environment is quite neat already, thanks! – Uname May 30 '18 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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