2

I am writing in two columns. I am trying to align the text vertically such that it does not add extra spaces. Happy for the content to be finished before the end of the page.
This is what I want:

Table of contents aligned

The class for this one is dndbook

\documentclass[letterpaper,twocolumn,openany,nodeprecatedcode]{dndbook}
\usepackage{listings}
\usepackage{shortvrb}
\usepackage{stfloats}
\MakeShortVerb{|}
\lstset{%
  basicstyle=\ttfamily,
  language=[LaTeX]{TeX},
  breaklines=true,
}
\begin{document}
\frontmatter
\maketitle
\tableofcontents

This is what I have:

Table of contents not aligned

I am using \raggedbottom and extarticle class:

\documentclass[twoside,twocolumn,10pt]{extarticle}
\raggedbottom
\begin{document}
\tableofcontents
\pagebreak
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\section{A section}
\end{document}
4
  • 1
    Welcome to TeX.SE. Please, can you help us to put a complete compilable code to solve your problem?
    – Sebastiano
    Aug 25, 2020 at 22:53
  • I have added the code. The complete code is really long. I have just added the parts which I think are relevant. Aug 25, 2020 at 23:25
  • 3
    It is very useful to have the relevant code deleting the packages that are not importants.
    – Sebastiano
    Aug 25, 2020 at 23:38
  • Hopefully removing \raggedbottom will solve the issue
    – MadyYuvi
    Jan 10 at 5:23

1 Answer 1

1

Rather than using the twocolumn option for the document class, consider using the multicol package (\usepackage{multicol}) with a single \begin{multicol}{2} environment surrounding the table of contents:

\begin{multicols}{2}
\tableofcontents
\end{multicols}
\pagebreak

(You can start another one on the next page if need be.)

See the package documentation.

You must log in to answer this question.

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