Estava brincando \@outputdblcol
e pensei nisso:
\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}
Mas, curiosamente, embora as colunas estejam na ordem correta, o TOC está fora de ordem. Por que isso está acontecendo? e como alguém deve consertar isso? (claro, sem alterar a definição de \@outputdblcol
sua forma original)?
Usando a sugestão de David Carlisle, recebo exatamente o mesmo problema:
\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}
mas este funciona bem:
\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}
Estou interessado apenas em como corrigir o TOC nos dois primeiros exemplos.
Responder1
\shipout
faz com que \write
os nós de gravação apareçam na lista vertical, não na ordem visual; portanto, embora você tenha trocado as colunas visualmente, \hskip-\textwidth
isso não altera a ordem de gravação. Em vez de fazer isso, você não pode gerar as colunas em ordem natural, mas com diretivas para xetex (ou equivalente a luatex) para usar a configuração RTL?
\hb@xt@\textwidth {\beginR%
..
Eu acho \beginR
que é ocertomaneira de fazer isso (mas não funciona), então voltemos a embaralhar as caixas manualmente. Isso parece funcionar:
\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}