如何将目录变为双栏结构?

2019-09-05 22:06发布

[图]效果如下想在ctexart中实现这种效果(源码读了。。看不懂QAQ

效果如下

}UCP81[_QPFRJF2)ZRRIOM8.png

想在ctexart中实现这种效果(源码读了。。看不懂QAQ

3条回答
lingdanda
2019-09-10 12:46

by  Heiko Oberdiek 选自https://tex.stackexchange.com/questions/72749/centering-contents-name-with-twocolumn-contents


Example for article:

\documentclass[twocolumn]{article}
\makeatletter
\renewcommand*{\tableofcontents}{%
  \if@twocolumn
    \@restonecolfalse
  \else
    \@restonecoltrue
  \fi
  \twocolumn[\section*{\centering\contentsname}]%
  \@mkboth{\MakeUppercase\contentsname}%
          {\MakeUppercase\contentsname}%
  \thispagestyle{plain}%
  \@starttoc{toc}%
  \if@restonecol
    \onecolumn
  \else
    \clearpage
  \fi
}
\makeatother
\begin{document}
\tableofcontents
\section{Foobar}
\subsection{Hello World}
\subsubsection{Subsubsection}
\addtocontents{toc}{\protect\newpage}
\section{Last section}
\subsection{Last subsection}
\end{document}

Example for report:

\documentclass[twocolumn]{report}
\makeatletter
\renewcommand*{\tableofcontents}{%
  \if@twocolumn
    \@restonecolfalse
  \else
    \@restonecoltrue
  \fi
  \twocolumn[\@makeschapterhead{\centering\contentsname}]%
  \@mkboth{\MakeUppercase\contentsname}%
          {\MakeUppercase\contentsname}%
  \thispagestyle{plain}%
  \@starttoc{toc}%
  \if@restonecol
    \onecolumn
  \else
    \clearpage
  \fi
}
\makeatother
\begin{document}
\tableofcontents
\chapter{Foobar}
\section{Hello World}
\subsection{Subsection}
\addtocontents{toc}{\protect\newpage}
\chapter{Last chapter}
\section{Last section}
\end{document}

by  user31729 选自

https://tex.stackexchange.com/questions/353866/table-of-contents-in-two-column-without-multicol
\documentclass{book}
\usepackage{pgffor}
\makeatletter
\newcommand{\twocolumntoc}{%
  \chapter*{\contentsname
    \@mkboth{%
      \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
  \@starttoc{toc}%
}
\makeatother
\setcounter{tocdepth}{4}
\begin{document}
\twocolumn
\twocolumntoc
\onecolumn
\foreach \x in {1,...,50}{%
\chapter{Chap \x}
\section{Foo section}
\subsection{Foo subsec}
\subsubsection{Foo subsecsec}
}
\end{document}

一周热门 更多>

相关问答