2열 문서의 TOC 순서가 잘못됨

2열 문서의 TOC 순서가 잘못됨

나는 놀고 있었고 \@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원래 형태로 바꾸지 않고)?

David Carlisle의 제안을 사용하면 똑같은 문제가 발생합니다.

\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}

처음 두 가지 예에서 TOC를 수정하는 방법에만 관심이 있습니다.

답변1

\shipout\write쓰기 노드가 시각적 순서가 아닌 세로 목록에 나타나는 순서대로 표시 되므로 열을 시각적으로 교체하는 동안 \hskip-\textwidth쓰기 순서는 변경되지 않습니다. 그렇게 하는 대신 자연 순서로 열을 출력할 수 없지만 RTL 설정을 사용하기 위해 xetex(또는 luatex와 동등한)에 대한 지시문을 사용하여 출력할 수 있습니까?

\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}

관련 정보