Я поигрался \@outputdblcol
и придумал вот это:
\documentclass[twocolumn]{article}
\makeatletter
\def\@outputdblcol{%
\if@firstcolumn
\global \@firstcolumnfalse
\global \setbox\@leftcolumn \box\@outputbox
\else
\global \@firstcolumntrue
\setbox\@outputbox \vbox {%
\hb@xt@\textwidth {%
\hskip\columnwidth
\hfil
{\normalcolor\vrule \@width\columnseprule}%
\hfil
\hb@xt@\columnwidth {%
\box\@outputbox \hss}%
\hskip-\textwidth
\hb@xt@\columnwidth {%
\box\@leftcolumn \hss}%
\hskip\columnwidth \hskip\columnsep
}%
}%
\@combinedblfloats
\@outputpage
\begingroup
\@dblfloatplacement
\@startdblcolumn
\@whilesw\if@fcolmade \fi
{\@outputpage
\@startdblcolumn}%
\endgroup
\fi
}
\makeatother
\pagestyle{headings}
\begin{document}
\tableofcontents
\section{Correct Headings}
Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin
\section{Part}
Some useless text that we are provingin
\newpage
\section{Wrong Headings}
Some useless text that we are provingin
\section{Another Part}
Some useless text that we are provingin
\section{LAst Part}
Some useless text that we are provingin
\end{document}
Но интересно, что хотя столбцы в правильном порядке, но TOC не в порядке. Почему так происходит? и как это исправить? (конечно, не меняя определение на \@outputdblcol
его первоначальный вид)?
Используя предложение Дэвида Карлайла, я получаю точно такую же проблему:
\documentclass[twocolumn]{article}
\TeXXeTstate=1
\makeatletter
\def\@outputdblcol{%
\if@firstcolumn
\global \@firstcolumnfalse
\global \setbox\@leftcolumn \box\@outputbox
\else
\global \@firstcolumntrue
\setbox\@outputbox \vbox {%
\hb@xt@\textwidth {\beginR%
\hb@xt@\columnwidth {%
\box\@leftcolumn \hss}%
\hfil
{\normalcolor\vrule \@width\columnseprule}%
\hfil
\hb@xt@\columnwidth {%
\box\@outputbox \hss}%
\endR}%
}%
\@combinedblfloats
\@outputpage
\begingroup
\@dblfloatplacement
\@startdblcolumn
\@whilesw\if@fcolmade \fi
{\@outputpage
\@startdblcolumn}%
\endgroup
\fi
}
\makeatother
\pagestyle{headings}
\begin{document}
\tableofcontents
\section{Correct Headings}
Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin
\section{Part}
Some useless text that we are provingin
\newpage
\section{Wrong Headings}
Some useless text that we are provingin
\section{Another Part}
Some useless text that we are provingin
\section{LAst Part}
Some useless text that we are provingin
\end{document}
но этот работает отлично:
\documentclass[twocolumn]{article}
\TeXXeTstate=1
\makeatletter
\def\@outputdblcol{%
\if@firstcolumn
\global \@firstcolumnfalse
\global \setbox\@leftcolumn \box\@outputbox
\else
\global \@firstcolumntrue
\setbox\@outputbox \vbox {%
\hb@xt@\textwidth {%
\hskip\columnwidth
\hfil
{\normalcolor\vrule \@width\columnseprule}%
\hfil
\hb@xt@\columnwidth {%
\box\@leftcolumn \hss}%
\hskip-\textwidth
\hb@xt@\columnwidth {%
\box\@outputbox \hss}%
\hskip\columnwidth\hskip\columnsep }%
}%
\@combinedblfloats
\@outputpage
\begingroup
\@dblfloatplacement
\@startdblcolumn
\@whilesw\if@fcolmade \fi
{\@outputpage
\@startdblcolumn}%
\endgroup
\fi
}
\makeatother
\pagestyle{headings}
\begin{document}
\tableofcontents
\section{Correct Headings}
Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin
\section{Part}
Some useless text that we are provingin
\newpage
\section{Wrong Headings}
Some useless text that we are provingin
\section{Another Part}
Some useless text that we are provingin
\section{LAst Part}
Some useless text that we are provingin
\end{document}
Меня интересует только то, как исправить оглавление в первых двух примерах.
решение1
\shipout
делает \write
в том порядке, в котором узлы записи появляются в вертикальном списке, а не в визуальном порядке, поэтому, хотя вы визуально поменяли столбцы местами, \hskip-\textwidth
это не меняет порядок записи. Вместо этого вы можете вывести столбцы не в естественном порядке, а с директивами для xetex (или эквивалента luatex) для использования настройки RTL?
\hb@xt@\textwidth {\beginR%
..
Я думаю\beginR
этоверноспособ сделать это (но он не работает), поэтому вернемся к тасовке коробок вручную. Кажется, это работает:
\documentclass[twocolumn]{article}
\setlength\columnseprule{1pt}
\makeatletter
\TeXXeTstate=1
\makeatletter
\def\@outputdblcol{%
\if@firstcolumn
\global \@firstcolumnfalse
\global \setbox\@leftcolumn \box\@outputbox
\else
\global \@firstcolumntrue
\setbox\@outputbox \vbox {%
\hb@xt@\textwidth {%
\kern\textwidth\llap{\hb@xt@\columnwidth {%
\box\@leftcolumn \hss}}%
\kern-\textwidth
\rlap{\hb@xt@\columnwidth {%
\box\@outputbox \hss}}%
\hfil
{\normalcolor\vrule \@width\columnseprule}%
\hfil
}%
}%
\@combinedblfloats
\@outputpage
\begingroup
\@dblfloatplacement
\@startdblcolumn
\@whilesw\if@fcolmade \fi
{\@outputpage
\@startdblcolumn}%
\endgroup
\fi
}
\makeatother
\pagestyle{headings}
\begin{document}
\tableofcontents
\section{Correct Headings}
Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin Some useless text that we are provingin
\section{Part}
Some useless text that we are provingin
\newpage
\section{Wrong Headings}
Some useless text that we are provingin
\section{Another Part}
Some useless text that we are provingin
\section{LAst Part}
Some useless text that we are provingin
\end{document}