支持横向模式,并遵循以下设计

支持横向模式,并遵循以下设计

跟进问题我想知道如何优雅地将一些页面改为横向模式以显示图表等。特别是它应该支持我在原始问题(标记为答案)中发布的设计!基本上,当处于横向时,灰色区域的高度/宽度应该取决于页面方向。我只是不确定如何做到这一点。任何帮助都值得感激。

可选:如果我可以通过命令等创建没有灰色区域的新页面,那就太棒了。

答案1

如果您不需要在预览中旋转输出,而只需要旋转图形,那么简单的旋转\rotatebox就足够了:

\documentclass[
  a4paper,
  12pt,
  titlepage,
  ngerman,
  footheight=15pt,
  headheight=15pt,
  oneside% seems to be a onesided layout
]{scrbook}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[page]{totalcount}
\usepackage{amsmath}
\usepackage{geometry}
\geometry{total={170mm,257mm}}
\usepackage[dvipsnames,svgnames,x11names]{xcolor}

%% footer
\usepackage{scrlayer-scrpage}
\setlength\footheight{15pt}
\clearpairofpagestyles
\ifoot*{\pagemark}
\cfoot*{Center}
\ofoot*{Right}
\setkomafont{pageheadfoot}{\sffamily\small}
\addtokomafont{pagenumber}{\sffamily\small}

\renewcommand\pagemark{{%
    \textbf{\MakeUppercase{\pagename}}
    \usekomafont{pagenumber}%
    \thepage/\totalpages
}}

%% rules on every page
\DeclareNewLayer[
    background,
    bottommargin,
    addvoffset=-\footheight,
    addvoffset=-.5ex,
    mode=picture,
    contents=\putUL{\textcolor{Silver}{\rule[-\layerheight]{\layerwidth}{\layerheight}}}
]{bottomrule}
\DeclareNewLayer[
    clone=bottomrule,
    textarea,
    voffset=0pt,
    height=\paperheight,
    addhoffset=\textwidth,
    addhoffset=1ex
]{rightrule}
\AddLayersToPageStyle{@everystyle@}{bottomrule,rightrule}

%% logo on the title page
\usepackage{graphicx}
\DeclareNewLayer[
    clone=rightrule,
    contents=\putUL{\raisebox{-\height}{\makebox[5mm][r]{\includegraphics[scale=.7]{example-grid-100x100bp}}}}
]{titlepagelogo}
\DeclarePageStyleByLayers{titlepage}{titlepagelogo}
%%

\definecolor{rubgray}{gray}{0.7}
\definecolor{rubblue}{HTML}{003560}
\definecolor{rubgreen}{HTML}{8dae10}

\usepackage{blindtext}% for dummy text

\begin{document}
\begin{titlepage}
  \thispagestyle{titlepage}
  \begin{center}
    \vspace*{4cm}
    {\Huge \textbf{ \textcolor{rubgray}{ABSCHLUSSBERICHT}}}
    \\
    \vspace*{1cm}
    {\Large \textbf{ \textcolor{rubblue}{Funktionsweise und Datenschutzgefährdung der Smart Border Systeme}}}
    \\
    \vspace*{2cm}
    Abschlussbericht der Projektarbeit für das Fach\\
    \textbf{Datenschutz WS 16/17}\\
    Im Studienfach\\
    \textbf{    B.Sc. Angewandte Informatik}
  \end{center}
  \vfill
  \begin{flushright}
    \textbf{Saif Al-Dilaimi (xxx)} \\
    \textcolor{rubblue}{\textbf{RUHR-UNIVERSITÄT} BOCHUM} \\
    Institut für Neuroinformatik \\
    Ruhr-Universität Bochum \\
    Universitätsstraße 150 \\
    44801 Bochum
  \end{flushright}
\end{titlepage}

\blinddocument

\begin{figure}
  \rotatebox{90}{%
    \parbox[c][\textwidth][c]{\textheight}{%
      \centering
      \includegraphics[width=.8\linewidth,height=.5\textwidth]{example-image}
      \caption{What's the problem?}
  }}%
\end{figure}

\blindtext
\end{document}

带旋转框的图形


如果您希望在纵向文档中拥有真正的横向页面,则可以将typearea的选项paper=landscapepaper=portraitgeometry命令结合起来\newgeometry使用typearea的选项usegeometry

\documentclass[
  a4paper,
  12pt,
  titlepage,
  ngerman,
  footheight=15pt,
  headheight=15pt,
  usegeometry,
  oneside% seems to be a onesided layout
]{scrbook}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[page]{totalcount}
\usepackage{amsmath}
\usepackage{geometry}
\AtBeginDocument{\newgeometry{total={170mm,257mm}}}
\usepackage[dvipsnames,svgnames,x11names]{xcolor}

%% footer
\usepackage{scrlayer-scrpage}
\setlength\footheight{15pt}
\clearpairofpagestyles
\ifoot*{\pagemark}
\cfoot*{Center}
\ofoot*{Right}
\setkomafont{pageheadfoot}{\sffamily\small}
\addtokomafont{pagenumber}{\sffamily\small}

\renewcommand\pagemark{{%
    \textbf{\MakeUppercase{\pagename}}
    \usekomafont{pagenumber}%
    \thepage/\totalpages
}}

%% rules on every page
\DeclareNewLayer[
    background,
    bottommargin,
    addvoffset=-\footheight,
    addvoffset=-.5ex,
    mode=picture,
    contents=\putUL{\textcolor{Silver}{\rule[-\layerheight]{\layerwidth}{\layerheight}}}
]{bottomrule}
\DeclareNewLayer[
    clone=bottomrule,
    textarea,
    voffset=0pt,
    height=\paperheight,
    addhoffset=\textwidth,
    addhoffset=1ex
]{rightrule}
\AddLayersToPageStyle{@everystyle@}{bottomrule,rightrule}

%% logo on the title page
\usepackage{graphicx}
\DeclareNewLayer[
    clone=rightrule,
    contents=\putUL{\raisebox{-\height}{\makebox[5mm][r]{\includegraphics[scale=.7]{example-grid-100x100bp}}}}
]{titlepagelogo}
\DeclarePageStyleByLayers{titlepage}{titlepagelogo}
%%

\definecolor{rubgray}{gray}{0.7}
\definecolor{rubblue}{HTML}{003560}
\definecolor{rubgreen}{HTML}{8dae10}

\usepackage{blindtext}% for dummy text

\begin{document}
\begin{titlepage}
  \thispagestyle{titlepage}
  \begin{center}
    \vspace*{4cm}
    {\Huge \textbf{ \textcolor{rubgray}{ABSCHLUSSBERICHT}}}
    \\
    \vspace*{1cm}
    {\Large \textbf{ \textcolor{rubblue}{Funktionsweise und Datenschutzgefährdung der Smart Border Systeme}}}
    \\
    \vspace*{2cm}
    Abschlussbericht der Projektarbeit für das Fach\\
    \textbf{Datenschutz WS 16/17}\\
    Im Studienfach\\
    \textbf{    B.Sc. Angewandte Informatik}
  \end{center}
  \vfill
  \begin{flushright}
    \textbf{Saif Al-Dilaimi (xxx)} \\
    \textcolor{rubblue}{\textbf{RUHR-UNIVERSITÄT} BOCHUM} \\
    Institut für Neuroinformatik \\
    Ruhr-Universität Bochum \\
    Universitätsstraße 150 \\
    44801 Bochum
  \end{flushright}
\end{titlepage}

\blinddocument

\cleardoubleoddpage
\KOMAoptions{paper=landscape,DIV=current}
\newgeometry{total={257mm,170mm}}
\blindtext[2]

\cleardoubleoddpage
\KOMAoptions{paper=portrait,DIV=current}
\newgeometry{total={170mm,257mm}}
\blindtext[2]

\end{document}

在此处输入图片描述

如果需要经常切换,可以使用 存储一次设置,typearea然后\storeareas经常使用存储的设置:

\storeareas\useportrait
\cleardoubleoddpage
\KOMAoptions{paper=landscape,DIV=current}
\newgeometry{total={257mm,170mm}}
\storeareas\uselandscape
\blindtext[2]

\cleardoubleoddpage\useportrait
\blindtext[2]

\cleardoubleoddpage\uselandscape
\blindtext[2]

\cleardoubleoddpage\useportrait
\blindtext[2]

\cleardoubleoddpage\uselandscape
\blindtext[2]

\cleardoubleoddpage\useportrait
\blindtext[2]

或者您可以在文档前言中定义两个命令:

\newcommand*{\useportrait}{%
  \cleardoubleoddpage
  \KOMAoptions{paper=portrait,DIV=current}%
  \newgeometry{total={170mm,257mm}}%
}

\newcommand*{\uselandscape}{%
  \cleardoubleoddpage
  \KOMAoptions{paper=landscape,DIV=current}%
  \newgeometry{total={257mm,170mm}}%
}

并使用这些命令来切换:

\documentclass[
  a4paper,
  12pt,
  titlepage,
  ngerman,
  footheight=15pt,
  headheight=15pt,
  usegeometry,
  oneside% seems to be a onesided layout
]{scrbook}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[page]{totalcount}
\usepackage{amsmath}
\usepackage{geometry}
\newcommand*{\useportrait}{%
  \cleardoublepage
  \KOMAoptions{paper=portrait,DIV=current}%
  \newgeometry{total={170mm,257mm}}%
}
\newcommand*{\uselandscape}{%
  \cleardoublepage
  \KOMAoptions{paper=landscape,DIV=current}%
  \newgeometry{total={257mm,170mm}}%
}
\AtBeginDocument{\useportrait}

\usepackage[dvipsnames,svgnames,x11names]{xcolor}

%% footer
\usepackage{scrlayer-scrpage}
\setlength\footheight{15pt}
\clearpairofpagestyles
\ifoot*{\pagemark}
\cfoot*{Center}
\ofoot*{Right}
\setkomafont{pageheadfoot}{\sffamily\small}
\addtokomafont{pagenumber}{\sffamily\small}

\renewcommand\pagemark{{%
    \textbf{\MakeUppercase{\pagename}}
    \usekomafont{pagenumber}%
    \thepage/\totalpages
}}

%% rules on every page
\DeclareNewLayer[
    background,
    bottommargin,
    addvoffset=-\footheight,
    addvoffset=-.5ex,
    mode=picture,
    contents=\putUL{\textcolor{Silver}{\rule[-\layerheight]{\layerwidth}{\layerheight}}}
]{bottomrule}
\DeclareNewLayer[
    clone=bottomrule,
    textarea,
    voffset=0pt,
    height=\paperheight,
    addhoffset=\textwidth,
    addhoffset=1ex
]{rightrule}
\AddLayersToPageStyle{@everystyle@}{bottomrule,rightrule}

%% logo on the title page
\usepackage{graphicx}
\DeclareNewLayer[
    clone=rightrule,
    contents=\putUL{\raisebox{-\height}{\makebox[5mm][r]{\includegraphics[scale=.7]{example-grid-100x100bp}}}}
]{titlepagelogo}
\DeclarePageStyleByLayers{titlepage}{titlepagelogo}
%%

\definecolor{rubgray}{gray}{0.7}
\definecolor{rubblue}{HTML}{003560}
\definecolor{rubgreen}{HTML}{8dae10}

\usepackage{blindtext}% for dummy text

\begin{document}
\begin{titlepage}
  \thispagestyle{titlepage}
  \begin{center}
    \vspace*{4cm}
    {\Huge \textbf{ \textcolor{rubgray}{ABSCHLUSSBERICHT}}}
    \\
    \vspace*{1cm}
    {\Large \textbf{ \textcolor{rubblue}{Funktionsweise und Datenschutzgefährdung der Smart Border Systeme}}}
    \\
    \vspace*{2cm}
    Abschlussbericht der Projektarbeit für das Fach\\
    \textbf{Datenschutz WS 16/17}\\
    Im Studienfach\\
    \textbf{    B.Sc. Angewandte Informatik}
  \end{center}
  \vfill
  \begin{flushright}
    \textbf{Saif Al-Dilaimi (xxx)} \\
    \textcolor{rubblue}{\textbf{RUHR-UNIVERSITÄT} BOCHUM} \\
    Institut für Neuroinformatik \\
    Ruhr-Universität Bochum \\
    Universitätsstraße 150 \\
    44801 Bochum
  \end{flushright}
\end{titlepage}

\blinddocument

\uselandscape
\blindtext[2]

\useportrait
\blindtext[2]
\end{document}

答案2

问题中没有 MWE,所以我不知道你说landscape的横向模式是什么意思。也许你想使用包提供的环境pdflscape?我也不明白所需的布局是什么。

如果你想获得

在此处输入图片描述

您可以加载包scrhack

代码:

\documentclass[
  a4paper,
  12pt,
  titlepage,
  ngerman,
  footheight=15pt,
  headheight=15pt,
  oneside% seems to be a onesided layout
]{scrbook}
\usepackage{scrhack}% <- added
\usepackage{pdflscape}% <- added
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[page]{totalcount}
\usepackage{amsmath}
\usepackage{geometry}
 \geometry{
     total={170mm,257mm}
 }
\usepackage[dvipsnames,svgnames,x11names]{xcolor}

%% footer
\usepackage{scrlayer-scrpage}
\setlength\footheight{15pt}
\clearpairofpagestyles
\ifoot*{\pagemark}
\cfoot*{Center}
\ofoot*{Right}
\setkomafont{pageheadfoot}{\sffamily\small}
\addtokomafont{pagenumber}{\sffamily\small}

\renewcommand\pagemark{{%
    \textbf{\MakeUppercase{\pagename}}
    \usekomafont{pagenumber}%
    \thepage/\totalpages
}}

%% rules on every page
\DeclareNewLayer[
    background,
    bottommargin,
    addvoffset=-\footheight,
    addvoffset=-.5ex,
    mode=picture,
    contents=\putUL{\textcolor{Silver}{\rule[-\layerheight]{\layerwidth}{\layerheight}}}
]{bottomrule}
\DeclareNewLayer[
    clone=bottomrule,
    textarea,
    voffset=0pt,
    height=\paperheight,
    addhoffset=\textwidth,
    addhoffset=1ex
]{rightrule}
\AddLayersToPageStyle{@everystyle@}{bottomrule,rightrule}

%% logo on the title page
\usepackage{graphicx}
\DeclareNewLayer[
    clone=rightrule,
    contents=\putUL{\raisebox{-\height}{\makebox[5mm][r]{\includegraphics[scale=.7]{example-grid-100x100bp}}}}
]{titlepagelogo}
\DeclarePageStyleByLayers{titlepage}{titlepagelogo}
%%

\definecolor{rubgray}{gray}{0.7}
\definecolor{rubblue}{HTML}{003560}
\definecolor{rubgreen}{HTML}{8dae10}

\usepackage{blindtext}% for dummy text

\begin{document}
\begin{titlepage}
  \thispagestyle{titlepage}
  \begin{center}
    \vspace*{4cm}
    {\Huge \textbf{ \textcolor{rubgray}{ABSCHLUSSBERICHT}}}
    \\
    \vspace*{1cm}
    {\Large \textbf{ \textcolor{rubblue}{Funktionsweise und Datenschutzgefährdung der Smart Border Systeme}}}
    \\
    \vspace*{2cm}
    Abschlussbericht der Projektarbeit für das Fach\\
    \textbf{Datenschutz WS 16/17}\\
    Im Studienfach\\
    \textbf{    B.Sc. Angewandte Informatik}
  \end{center}
  \vfill
  \begin{flushright}
    \textbf{Saif Al-Dilaimi (xxx)} \\
    \textcolor{rubblue}{\textbf{RUHR-UNIVERSITÄT} BOCHUM} \\
    Institut für Neuroinformatik \\
    Ruhr-Universität Bochum \\
    Universitätsstraße 150 \\
    44801 Bochum
  \end{flushright}
\end{titlepage}

\blinddocument
\begin{landscape}
\Blindtext
\end{landscape}
\blinddocument
\end{document}

关于您的第二个问题:您可以定义从页面样式中添加或删除图层的命令。

\newcommand*\AddRulesToPageStyles{%
  \IfLayerAtPageStyle{@everystyle@}{bottomrule}{}{%
    \AddLayersToPageStyle{@everystyle@}{bottomrule}}
  \IfLayerAtPageStyle{@everystyle@}{rightrule}{}{%
    \AddLayersToPageStyle{@everystyle@}{rightrule}}
}
\newcommand*\RemoveRulesFromPageStyles{%
  \RemoveLayersFromPageStyle{@everystyle@}{bottomrule,rightrule}%
}

请注意,页面样式@everystyle@很特殊:它的图层是所有图层页面样式的一部分。

在此处输入图片描述

代码:

\documentclass[
  a4paper,
  12pt,
  titlepage,
  ngerman,
  footheight=15pt,
  headheight=15pt,
  oneside% seems to be a onesided layout
]{scrbook}
\usepackage{scrhack}% <- added
\usepackage{pdflscape}% <- added
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[page]{totalcount}
\usepackage{amsmath}
\usepackage{geometry}
 \geometry{
     total={170mm,257mm}
 }
\usepackage[dvipsnames,svgnames,x11names]{xcolor}

%% footer
\usepackage{scrlayer-scrpage}
\setlength\footheight{15pt}
\clearpairofpagestyles
\ifoot*{\pagemark}
\cfoot*{Center}
\ofoot*{Right}
\setkomafont{pageheadfoot}{\sffamily\small}
\addtokomafont{pagenumber}{\sffamily\small}

\renewcommand\pagemark{{%
    \textbf{\MakeUppercase{\pagename}}
    \usekomafont{pagenumber}%
    \thepage/\totalpages
}}

%% rules on every page
\DeclareNewLayer[
    background,
    bottommargin,
    addvoffset=-\footheight,
    addvoffset=-.5ex,
    mode=picture,
    contents=\putUL{\textcolor{Silver}{\rule[-\layerheight]{\layerwidth}{\layerheight}}}
]{bottomrule}
\DeclareNewLayer[
    clone=bottomrule,
    textarea,
    voffset=0pt,
    height=\paperheight,
    addhoffset=\textwidth,
    addhoffset=1ex
]{rightrule}
\newcommand*\AddRulesToPageStyles{%
  \IfLayerAtPageStyle{@everystyle@}{bottomrule}{}{%
    \AddLayersToPageStyle{@everystyle@}{bottomrule}}
  \IfLayerAtPageStyle{@everystyle@}{rightrule}{}{%
    \AddLayersToPageStyle{@everystyle@}{rightrule}}
}
\newcommand*\RemoveRulesFromPageStyles{%
  \RemoveLayersFromPageStyle{@everystyle@}{bottomrule,rightrule}%
}
\AddRulesToPageStyles

%% logo on the title page
\usepackage{graphicx}
\DeclareNewLayer[
    clone=rightrule,
    contents=\putUL{\raisebox{-\height}{\makebox[5mm][r]{\includegraphics[scale=.7]{example-grid-100x100bp}}}}
]{titlepagelogo}
\DeclarePageStyleByLayers{titlepage}{titlepagelogo}
%%

\definecolor{rubgray}{gray}{0.7}
\definecolor{rubblue}{HTML}{003560}
\definecolor{rubgreen}{HTML}{8dae10}

\usepackage{blindtext}% for dummy text

\begin{document}
\begin{titlepage}
  \thispagestyle{titlepage}
  \begin{center}
    \vspace*{4cm}
    {\Huge \textbf{ \textcolor{rubgray}{ABSCHLUSSBERICHT}}}
    \\
    \vspace*{1cm}
    {\Large \textbf{ \textcolor{rubblue}{Funktionsweise und Datenschutzgefährdung der Smart Border Systeme}}}
    \\
    \vspace*{2cm}
    Abschlussbericht der Projektarbeit für das Fach\\
    \textbf{Datenschutz WS 16/17}\\
    Im Studienfach\\
    \textbf{    B.Sc. Angewandte Informatik}
  \end{center}
  \vfill
  \begin{flushright}
    \textbf{Saif Al-Dilaimi (xxx)} \\
    \textcolor{rubblue}{\textbf{RUHR-UNIVERSITÄT} BOCHUM} \\
    Institut für Neuroinformatik \\
    Ruhr-Universität Bochum \\
    Universitätsstraße 150 \\
    44801 Bochum
  \end{flushright}
\end{titlepage}

\blinddocument
\begin{landscape}
\RemoveRulesFromPageStyles
\Blindtext
\end{landscape}
\AddRulesToPageStyles
\blinddocument
\end{document}

相关内容