2열 세로에서 1열 가로로: 텍스트와 페이지 번호(가로 모드에서)를 왼쪽 여백에 강제로 배치합니다.

2열 세로에서 1열 가로로: 텍스트와 페이지 번호(가로 모드에서)를 왼쪽 여백에 강제로 배치합니다.

다음 코드에서 텍스트 Hola와 페이지 번호를 2회전된 페이지의 왼쪽 상단 여백에 강제로 배치하도록 도와주세요.

Hola참고: 저는 2열 세로 문서로 작업 중이며 텍스트가 왼쪽 상단 테두리에 있는 1열 가로로 임시 변경해야 합니다 .

감사해요!

\documentclass[twocolumn]{article}

% Packages for various functionalities
\usepackage{lipsum} % For dummy text; you can remove this in your actual document
\usepackage{graphicx} % For including images
\usepackage{caption} % For captions
\usepackage{authblk} % For author affiliations
\usepackage{longtable} % For long tables
\usepackage{pdflscape} % For landscape pages
\usepackage[margin=1in]{geometry} % Adjust margins as desired
\usepackage{showframe} % To display page borders
\usepackage{geometry} %to change page margins
 \geometry{
 letterpaper,
 left=10mm,
 top=10mm,
 bottom=10mm,
 right=10mm
 }
 
% Title and authors
\title{Your Title Here}
\author[1]{Author One}
\author[2]{Author Two}
\affil[1]{Affiliation One}
\affil[2]{Affiliation Two}

\begin{document}

\maketitle

\section{Introduction}
% ... (Sections and content here)


\begin{landscape}
\newgeometry{margin=2cm, top=2cm, bottom=2cm, left=2cm, right=2cm} % Adjust margins for landscape page
\clearpage %needed for next command
\onecolumn %reset to one column mode


Hola

\clearpage %needed for next command
\twocolumn %reset to two-column mode
\restoregeometry %return to initial page margins
\end{landscape}


\section{Discussion}
% ... (Remaining content here)

\end{document}

현재 나쁜 결과는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

나는 아래와 같은 결과를 원합니다(왼쪽).

여기에 이미지 설명을 입력하세요

답변1


2024년 1월 4일 목요일 22:24(UTC +0000)에 편집:

문제 1:

~ 안에TeX - LaTeX 스택 교환 채팅 Ulrike Fischer가 지적함\newgeometry패키지와 함께기하학onecolumn를 통해 1열 모드로 전환하더라도 -옵션을 적용해야 합니다 \onecolumn.

문제 2:

활자 블록은 문서 페이지의 텍스트를 담는 상자입니다. (머리글/바닥글이나 여백 메모가 아닙니다.)

그러나 LaTeX에서는 매개변수/길이 \typeblockwidth/ \typeblockheight가 도입되지 않습니다.

대신, 각각은 \textwidth다음 \textheight두 가지를 결정합니다.

어쨌든

  • \textwidth활자 블록의 수평 확장을 결정하는 것입니다.
  • \textheight활자블록의 수직 확장을 결정하는 것입니다.

활자 블록 내의 텍스트가 수평으로 정렬되는 경우

  • \textwidth또한 활자 블록에 맞는 텍스트 줄의 최대 길이를 결정하는 것입니다.
  • \textheight또한 활자 블록 내에서 텍스트 줄을 서로 겹쳐서 배치하는 데 사용할 수 있는 공간의 양을 결정하는 것입니다.

활자 블록 내의 텍스트가 수직으로 정렬되는 경우

  • \textwidth또한 활자 블록 내에서 텍스트 줄을 서로 겹쳐서 배치하는 데 사용할 수 있는 공간의 양을 결정하는 것입니다.
  • \textheight또한 활자 블록에 맞는 텍스트 줄의 최대 길이를 결정하는 것입니다.

landscape패키지 환경 내에서lscape1은 \textheight 텍스트 줄을 서로 겹쳐 배치하는 페이지의 활자 블록 내에서 사용할 수 있는 공간의 양을 결정하기 위해 변경되었으며, 페이지의 활자 블록 내의 이러한 줄은 수직으로 정렬됩니다.

\textheight이 변경은 활자 블록 내의 텍스트가 수평 또는 수직으로 정렬되는지 여부에 관계없이 어떤 경우에도 활자 블록의 수직 확장을 결정한다는 사실을 무시합니다 .

landscape즉, 패키지 환경이lscape1이 적용되면 \textheight더 이상 활자 블록의 수직 확장을 결정하지 않습니다.

\ShowFramePicture하지만 패키지의 루틴으로쇼프레임\textheight프레임을 그리기 위해 어떤 경우에도 활자 블록의 수직 확장을 결정한다고 가정합니다 .

따라서lscape를 통해 프레임 세트를 그리기 전에 의 1개 수정을 실행 취소 해야 합니다 .\textheight\ShowFramePicture

그래서 나는 프레임을 그리는 동안 적용되는 로컬 범위 내에서만 재설정하기 위해 -environment \ShowFramePicture내에서 재정의 하기로 결정했습니다.landscape\textheight

1 패키지pdflscape내부적으로 부하lscapelandscape패키지 환경을 수정합니다.lscape환경이 landscape적용되는 동안 .pdf 파일로 제공되는 각 페이지에 PDF 뷰어에 대한 지시문이 추가되어 이 페이지가 90도 각도로 회전된 화면에 표시됩니다. 이 지시문은 컴퓨터 화면/.pdf 파일을 보는 데 사용되는 디스플레이에 페이지가 표시되는 방식에만 영향을 미칩니다. 이 지시문은 실제로 TeX의 조판 작업에 영향을 주지 않습니다. 이는 PDF 파일을 보는 데 사용되는 프로그램의 "작업 표시"에 영향을 줍니다. 환경이 적용되는 동안 페이지가 조판되고 배송되더라도 landscape활자 블록의 텍스트 줄은 수직으로 정렬되지만 해당 페이지처럼 화면/디스플레이에서 읽기 위해 머리를 왼쪽이나 오른쪽으로 기울일 필요가 없습니다. 컴퓨터의 화면/디스플레이를 왼쪽에서 오른쪽으로 보면서 읽을 수 있도록 90도 회전되어 표시됩니다.


\documentclass[twocolumn, letterpaper]{article}

% Packages for various functionalities
\usepackage{lipsum} % For dummy text; you can remove this in your actual document
\usepackage{graphicx} % For including images
\usepackage{caption} % For captions
\usepackage{authblk} % For author affiliations
\usepackage{longtable} % For long tables
\usepackage{pdflscape} % For landscape pages
\usepackage{geometry} %to change page margins
\usepackage{showframe} % To display page borders

\geometry{
 letterpaper,
 left=20mm,
 top=20mm,
 bottom=20mm,
 right=20mm
}

\newcommand\savetextheight{}%

% Title and authors
\title{Your Title Here}
\author[1]{Author One}
\author[2]{Author Two}
\affil[1]{Affiliation One}
\affil[2]{Affiliation Two}

\begin{document}

\maketitle

\section{Introduction}
%... (Sections and content here)
\lipsum[1-8]

\onecolumn %reset to one column mode
\newgeometry{onecolumn, margin=2cm, top=2cm, bottom=2cm, left=2cm, right=2cm}% Adjust margins for landscape page

\edef\savetextheight{\number\textheight\space sp\relax}%
\begin{landscape}%
\makeatletter
\renewcommand\ShowFramePicture{%
  \begingroup
    % -------------------------------------------------------------------------------------------
    %  \textheight is modified within the landscape-environment because the box holding the text
    %  is rotated. But the frames around the text are drawn on the sheet of paper, which during
    %  typesetting is not rotated (, although pdflscape tells pdf-viewers to display it rotated).
    %  Thus modification of \textheight is to be undone while drawing the frames:
    % -------------------------------------------------------------------------------------------
    \textheight=\savetextheight
    % -------------------------------------------------------------------------------------------
    \ShowFrameColor\linethickness{\ShowFrameLinethickness}%
    \AtPageLowerLeft{%
      \framebox(\paperwidth,\paperheight){}}%
    \AtTextLowerLeft{%
      \framebox(\textwidth,\textheight){}}%
    \AtTextUpperLeft{%
      \put(0,\headsep){%
        \framebox(\textwidth,\headheight){}}}%
    \AtTextLowerLeft{%
      \put(0,-\footskip){%
        \line(1,0){\textwidth}}}%
    \AtTextLowerLeft{%
      \SF@tempdima=\textwidth\advance\SF@tempdima\marginparsep
      \if@twoside
        \ifodd\c@page\else
          \if@mparswitch
            \SF@tempdima=-\marginparsep\advance\SF@tempdima-\marginparwidth
          \fi
        \fi
      \fi
      \put(\SF@tempdima,0)%
        {\framebox(\marginparwidth,\textheight){}}%
    }%
  \endgroup
}
\makeatother
\noindent Hola \lipsum[1-18]
\clearpage
\lipsum[1-8]
\end{landscape}%

\twocolumn
\restoregeometry %return to initial page margins

\section{Discussion}
% ... (Remaining content here)
\lipsum[1-8]

\end{document}
여기에 이미지 설명을 입력하세요

답변2

TeX.SE에 오신 것을 환영합니다!

다음 MWE(최소 작업 예제)는 문제의 두 번째 이미지를 재현합니다.

\documentclass[twocolumn]{article}
\usepackage[letterpaper,
            margin=1in]{geometry} % Adjust margins as desired

\usepackage{afterpage} % For landscape pages
\usepackage{pdflscape} % For landscape pages

% Packages for various functionalities
\usepackage{lipsum} % For dummy text; you can remove this in your actual document
\usepackage{graphicx} % For including images
\usepackage{caption} % For captions
\usepackage{authblk} % For author affiliations
\usepackage{longtable} % For long tables
                    

% Title and authors
\title{Your Title Here}
\author[1]{Author One}
\author[2]{Author Two}
\affil[1]{Affiliation One}
\affil[2]{Affiliation Two}

\begin{document}
\pagestyle{plain}

\maketitle

\section{Introduction}
\lipsum[1-4]

\afterpage{%
    \clearpage
\newgeometry{margin=20mm} % Adjust margins for landscape page
\onecolumn              % reset to one column mode
    \begin{landscape}

Hola, landscape here!

\lipsum[1-3]

    \end{landscape}
\restoregeometry %return to initial page margins
\twocolumn %reset to two-column mode
            }% end afterpage          
\lipsum[6]

\section{Discussion}
\lipsum[7-13]

\end{document}

여기에 이미지 설명을 입력하세요

페이지 번호를 어디에 두고 싶은지 완전히 명확하지 않습니다. 지금까지는 기본 위치(발 중앙)로 두었습니다.

다른 위치에 페이지 번호를 갖고 싶은 경우, 예를 들어 use fancyhdr패키지를 사용하여 새로운 머리글/바닥글 스타일을 정의해야 합니다. 예를 들어, 서문에 추가하려면

\usepackage{fancyhdr}    
\fancypagestyle{LandScape}%
{%
\fancyhf{}%
\fancyhead[L]{\thepage}%
\renewcommand{\headrulewidth}{0pt}%
\renewcommand{\footrulewidth}{0pt}%
}

\begin{landscape}문서 본문 삽입 전

\pagestyle{LandScape}

결과 페이지 스타일은 다음과 같습니다.

여기에 이미지 설명을 입력하세요

편집하다:

  • \newgeometry다른 문서(세로 방향) 페이지 형상과 동일한 설정이 있을 때 정의하는 이유가 명확하지 않습니다 . 그런 경우에는 사용하지 않을 것입니다. 즉, 귀하의 경우에는 간단히 삭제하겠습니다.
  • 모든 페이지에서 페이지 레이아웃 프레임을 올바르게 그리는 것이 주요 관심사라면 @Ulrich Diez가 제안한 솔루션(+1)을 고수해야 합니다.
  • 약간 수정된 코드를 사용하여 내 원래 답변에 채택된 그의 솔루션은 다음 MWE에 표시됩니다.
\documentclass[twocolumn]{article}
\usepackage[letterpaper,
            margin=1in]{geometry} % Adjust margins as desired
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.5pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}     % For dummy text; in actual document
                        % you can/should remove it

\newcommand\savetextheight{}%
\edef\savetextheight{\number\textheight\space sp\relax}%
\makeatletter%
\renewcommand\ShowFramePicture{%
    \textheight=\savetextheight
%---------------------------------------------------------------%
\ShowFrameColor\linethickness{\ShowFrameLinethickness}%
\AtTextLowerLeft{% text box
  \framebox(\textwidth,\textheight){}}%
\AtTextUpperLeft{% page header
  \put(0,\headsep){%
    \framebox(\textwidth,\headheight){}}}%
\AtTextLowerLeft{% page margin
  \put(0,-\footskip){%
    \line(1,0){\textwidth}}}%
\AtTextLowerLeft{%  when document is twoside
  \SF@tempdima=\textwidth\advance\SF@tempdima\marginparsep
  \if@twoside
    \ifodd\c@page\else
      \if@mparswitch
        \SF@tempdima=-\marginparsep\advance\SF@tempdima-\marginparwidth
      \fi
    \fi
  \fi
  \put(\SF@tempdima,0)%
    {\framebox(\marginparwidth,\textheight){}}%
                }% end of twoside
                    }% end of \renewcommand
\makeatother

% Packages for various functionalities
\usepackage{afterpage}  % For remove empty space on page before 
                        % landscape page with text after it
\usepackage{pdflscape}  % For landscape pages
\usepackage{graphicx}   % For including images
\usepackage{caption}    % For captions
\usepackage{authblk}    % For author affiliations
\usepackage{longtable}  % For long tables


% Title and authors
\title{Your Title Here}
\author[1]{Author One}
\author[2]{Author Two}
\affil[1]{Affiliation One}
\affil[2]{Affiliation Two}

%---------------------------------------------------------------%
\begin{document}
\maketitle
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
\lipsum[1-4]

\afterpage{%
    \clearpage
\onecolumn                  % reset to one column mode
\begin{landscape}%
Hola, landscape here!

\lipsum[1-2]

\begin{longtable}[htb]{|p{\dimexpr\textwidth-2\tabcolsep}|}
\caption{Longtable: width = \texttt{textwidth}} \\
    \hline
\lipsum[66] \\
    \hline
\end{longtable}

\begin{longtable}[htb]{|p{\dimexpr\textheight-2\tabcolsep}|}
\caption{Longtable: width = \texttt{textheight}} \\
    \hline
\lipsum[66] \\
    \hline
\end{longtable}

\begin{longtable}[htb]{|p{\dimexpr\linewidth-2\tabcolsep}|}
\caption{Longtable: width = \texttt{linewidth}} \\
    \hline
\lipsum[66] \\
    \hline
\end{longtable}

\end{landscape}%
\twocolumn
        }% end \afterpage


\section{Discussion}
\lipsum[1-8]

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보