Estaba jugando \@outputdblcol
y se me ocurrió esto:
\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}
Pero, curiosamente, aunque las columnas están en el orden correcto, el TOC está desordenado. ¿Por qué está pasando esto? ¿Y cómo se debería solucionar? (por supuesto, sin cambiar la definición de \@outputdblcol
a su forma original)?
Usando la sugerencia de David Carlisle, tengo exactamente el mismo 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}
pero este funciona bien:
\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}
Solo me interesa cómo solucionar el TOC en los dos primeros ejemplos.
Respuesta1
\shipout
hace que los \write
nodos de escritura aparezcan en el orden en que aparecen en la lista vertical, no en el orden visual, por lo que si bien ha intercambiado las columnas visualmente, \hskip-\textwidth
esto no cambia el orden de escritura. En lugar de hacer eso, ¿no puede generar las columnas en orden natural pero con directivas para xetex (o equivalente a luatex) para usar la configuración RTL?
\hb@xt@\textwidth {\beginR%
..
creo que \beginR
es elbienmanera de hacer esto (pero no funciona), así que volvamos a barajar cajas a mano. Esto 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}