\marginpar 从页面顶部开始

\marginpar 从页面顶部开始

我正在尝试在页边距中构建一个 minitoc。它可以跨越几页。页面顶部没有图片时一切都很好。我需要内容从第二页的打字区域顶部开始。

梅威瑟:

\documentclass{article}
\usepackage{marginfix}
\usepackage{geometry}
\textwidth=2in
\geometry{paperwidth=4in, paperheight=3in, lmargin=1cm, rmargin=4cm, bottom=1.5em, nohead}
\marginparsep=20pt
\usepackage[frame]{crop}

\usepackage{filecontents}

\begin{filecontents}{mytoc.tex}
\marginpar{This text gets written}
\marginpar{This text gets written}
\marginpar{This text gets written}
\marginpar{This text gets written}
\marginpar{This text gets written}
\marginpar{This text gets written}
\marginpar{This text gets written}
\marginpar{This text gets written}
\end{filecontents}

\begin{document}
\input mytoc.tex
some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 

some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 

some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 

some text some text some text some text some text 

\begin{figure}
\fbox{\vbox to 2cm{\hsize=2cm \null\hfill}}
\end{figure}
\end{document} 

输出:

在此处输入图片描述

或者也许有针对边缘内容的特殊包装?

答案1

该解决方案使用paracol而不是\marginpar

\documentclass{book}
\usepackage{geometry}
\geometry{paperwidth=4in, paperheight=3in, lmargin=1cm, rmargin=1cm, bottom=1.5em}

\usepackage{paracol}
\columnsep=20pt
\setcolumnwidth{2in,\dimexpr 2in-2cm-\columnsep\relax}
\twosided[pc]% swap margins and columns

\usepackage{filecontents}

\begin{filecontents}{mytoc.tex}
This text gets written\\
This text gets written\\
This text gets written\\
This text gets written\\
This text gets written\\
This text gets written\\
This text gets written\\
This text gets written\\
This text gets written\\
\end{filecontents}

\begin{document}
\begin{paracol}{2}
\switchcolumn
\bgroup\parindent=0pt\raggedright% normal \marginpar parameters
\input mytoc.tex
\egroup% keep local
\switchcolumn

some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 

some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 

some text some text some text some text some text 
some text some text some text some text some text 
some text some text some text some text some text 

some text some text some text some text some text 

\begin{figure}
\fbox{\vbox to 2cm{\hsize=2cm \null\hfill}}
\end{figure}
\end{paracol}
\end{document} 

相关内容