长边横向标题

长边横向标题

第 2 页将以横向格式显示。如何将页眉放置在此页面的顶部长边上?

\documentclass[12pt,addpoints]{exam}
\usepackage[a4paper,left=2cm, right=2cm, top=3cm,bottom=3cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\setcounter{secnumdepth}{-1}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{makecell}
\usepackage{pdflscape}
\usepackage{array}
\pagestyle{headandfoot}
\firstpageheader%Kopfzeile
{
    \large{\textbf{Lorem ipsum }}\\
    \normalsize{Lorem ipsum }\\
    }
    {}
    {
        \begin{minipage}[b][5cm][b]{5cm}
            \singlespacing%
            \textbf{Lorem ipsum}\\
            Lorem ipsum \\
            Lorem ipsum \\
            Lorem ipsum     
        \end{minipage}
    }
%\firstpageheadrule
\runningheader%Zeile der Laufseiten
    {
    \large{\textbf{Lorem ipsum }}\\
    \normalsize{Lorem ipsum }\\
    }%
    {}%
    {%
        \begin{minipage}[b][5cm][b]{5cm}%
            \singlespacing%
            \textbf{Lorem ipsum}\\%
            Lorem ipsum \\%
            Lorem ipsum \\%
            Lorem ipsum %   
        \end{minipage}% 
    }
\runningheadrule
\firstpagefooter{}{}{Seite \thepage}
\runningfooter{}{}{Seite \thepage}
\begin{document}
    \section[A]{A}
    Test
    \pagebreak
    \begin{landscape}
    \begin{table}[p]
        \centering
        \normalsize
        \begin{tabular}{|p{1cm}|p{8cm}|p{8cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|}
            \hline
            \makecell[b]{\multirow{2}{1cm}{\textbf{Headline 1}}}&
            \makecell[b]{\multirow{2}{10cm}{\textbf{Headline 2}}}&
            \makecell[b]{\multirow{2}{10cm}{\textbf{Headline 3}}}&
            \makecell[b]{\multirow{2}{1cm}{\textbf{Headline 4}}} &
            \multicolumn{3}{c|}{\textbf{Headline 5}} \\ \cline{5-7}
            &
            &
            &
            &
            A&
            B&
            C\\
            \hline
            \makecell[c]{\parbox[0pt][4cm][c]{0cm}{1}}&
            \makecell[l]{
                Test Test Test\\
                Test Test Test \\
                Test
            }&
            &
            \makecell[c]{13.1}&
            \makecell[c]{3}&
            &
            \\
            \hline
            \makecell[c]{\parbox[0pt][8cm][c]{0cm}{2}}&
            \makecell[l]{
                \textbf{Test} \\
                Test Test Test\\
                Test Test Test\\
                Test Test Test
                \textbf{Test} \\
                Test Test Test\\
                Test Test Test\\
                Test Test Test
            }&
            &
            \makecell[c]{13.1}&
            \makecell[c]{3}&
            &
            \\
            \hline
        \end{tabular}
    \end{table}
    \end{landscape} 
\end{document}

在此处输入图片描述

答案1

在这种方法中,该包与从纵向到横向以及从横向到纵向的转换typearea一起使用 。geometry

A

\documentclass[12pt,addpoints]{exam}

\usepackage[usegeometry]{typearea}% Add here <<<<<<

\usepackage[a4paper,left=2cm, right=2cm, top=3cm,bottom=3cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\setcounter{secnumdepth}{-1}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{makecell}
\usepackage{pdflscape}
\usepackage{array}

\pagestyle{headandfoot}
\firstpageheader%Kopfzeile
{
    \large{\textbf{Lorem ipsum }}\\
    \normalsize{Lorem ipsum }\\
}
{}
{
    \begin{minipage}[b][5cm][b]{5cm}
        \singlespacing%
        \textbf{Lorem ipsum}\\
        Lorem ipsum \\
        Lorem ipsum \\
        Lorem ipsum     
    \end{minipage}
}
%\firstpageheadrule
\runningheader%Zeile der Laufseiten
{
    \large{\textbf{Lorem ipsum }}\\
    \normalsize{Lorem ipsum }\\
}%
{}%
{%
    \begin{minipage}[b][5cm][b]{5cm}%
        \singlespacing%
        \textbf{Lorem ipsum}\\%
        Lorem ipsum \\%
        Lorem ipsum \\%
        Lorem ipsum %   
    \end{minipage}% 
}
\runningheadrule
\firstpagefooter{}{}{Seite \thepage}
\runningfooter{}{}{Seite \thepage}
\begin{document}
    \section[A]{A}
    Test
\pagebreak

\KOMAoptions{paper=landscape,DIV=last} % added <<<<<<<<<<<<<<<<<<
\newgeometry{left=2cm, right=2cm, top=2cm,bottom=3cm,includehead}    % added <<<<<<<<<<<<<<<<<<
    
        \begin{table}[p]
            \centering
            \normalsize
            \begin{tabular}{|p{1cm}|p{8cm}|p{8cm}|p{1cm}|p{1cm}|p{1cm}|p{1cm}|}
                \hline
                \makecell[b]{\multirow{2}{1cm}{\textbf{Headline 1}}}&
                \makecell[b]{\multirow{2}{10cm}{\textbf{Headline 2}}}&
                \makecell[b]{\multirow{2}{10cm}{\textbf{Headline 3}}}&
                \makecell[b]{\multirow{2}{1cm}{\textbf{Headline 4}}} &
                \multicolumn{3}{c|}{\textbf{Headline 5}} \\ \cline{5-7}
                &
                &
                &
                &
                A&
                B&
                C\\
                \hline
                \makecell[c]{\parbox[0pt][4cm][c]{0cm}{1}}&
                \makecell[l]{
                    Test Test Test\\
                    Test Test Test \\
                    Test
                }&
                &
                \makecell[c]{13.1}&
                \makecell[c]{3}&
                &
                \\
                \hline
                \makecell[c]{\parbox[0pt][8cm][c]{0cm}{2}}&
                \makecell[l]{
                    \textbf{Test} \\
                    Test Test Test\\
                    Test Test Test\\
                    Test Test Test
                    \textbf{Test} \\
                    Test Test Test\\
                    Test Test Test\\
                    Test Test Test
                }&
                &
                \makecell[c]{13.1}&
                \makecell[c]{3}&
                &
                \\
                \hline
            \end{tabular}
        \end{table}
    
\clearpage % added <<<<<<<<<<<<<<<<<<
\KOMAoptions{paper=portrait,DIV=last} % added <<<<<<<<<<<<<<<<<<
\restoregeometry % added <<<<<<<<<<<<<<<<<<

\section[B]{B}
Another test Test
\end{document

用过的typearea.sty 2021/11/13 v3.35 KOMA-Script package (type area)

相关内容