Komascript - 重置文档内的几何形状

Komascript - 重置文档内的几何形状

编号段落后缩进文本我得到了关于如何在 Komascript 中缩进编号段落的极好建议,

\newcommand\secnumindent{1.5cm}
 .. command for the section itself
\hoffset=\dimexpr\hoffset + \secnumindent\relax    
\textwidth=\dimexpr\textwidth-\secnumindent\relax    
\paperwidth=\dimexpr\paperwidth -\secnumindent\relax

以及如何补偿和调整页脚

\usepackage[
  headwidth=\the\textwidth+\secnumindent:-\secnumindent,
  footwidth=head:-\secnumindent,
  headsepline,% to show the headwidth
  footsepline% to show the footwidth
]{scrlayer-scrpage}

五个月后,我现在希望能够重置正文中附录中一些长表格的几何形状。对于这些表格,我目前建议将它们旋转为横向,

\begin{landscape}

在此本地环境中,章节编号的缩进和对页脚的相应调整不再有意义。不清楚如何在文档正文中取消设置上述命令。如果我仅重置 \hoffset、\textwidth 和 \paperwidth 变量 - 那么页脚就会移动。但我不知道如何重置页脚参数。

注意-我也尝试过其他选择,例如

\KOMAoptions{pagesize,paper=landscape,DIV=12}

旋转附录的文本。这会使页脚与 \landscape 解决方案处于不同的轴上。这仍然会导致您需要调整页脚以使元素分布在整个横向宽度上的问题。

答案1

使用

\clearpage
\addtolength\hoffset{-\secnumindent}
\addtolength\textwidth{\secnumindent}
\KOMAoptions{headwidth=text,footwidth=head}

在此处输入图片描述


代碼KOMA-Script 版本 3.17 或更新版本

% -*- program: xelatex -*-
\documentclass[english, parskip=full, fontsize=11, DIV12, toc=left, numbers=noenddot]{scrartcl}
\usepackage{babel}
\usepackage{amsmath}
% just so we can see what is going on for now
%\usepackage{showframe}
\usepackage{blindtext}
% tighten up spacing of lists
\usepackage{enumitem}
\setlist{noitemsep}

\setcounter{secnumdepth}{4}
\newcommand\p{\paragraph{}}

\newcommand\secnumindent{1.5cm}
\RedeclareSectionCommands[indent=-\secnumindent]{section,subsection,paragraph}
\RedeclareSectionCommand[afterskip=0pt,counterwithin=subsection]{paragraph}
\renewcommand\sectionformat{\parbox{\secnumindent}{\thesection\autodot}}
\renewcommand\subsectionformat{\parbox{\secnumindent}{\thesubsection\autodot}}
\renewcommand\subsubsectionformat{\parbox{\secnumindent}{\thesubsubsection\autodot}}
\renewcommand\paragraphformat{\parbox{\secnumindent}{\theparagraph\autodot}}

% from the answer of @Steven:
\addtolength\hoffset{\secnumindent}
\addtolength\textwidth{-\secnumindent}
%
% make sure paragraphs reset counting also at sections    
%
\makeatletter
\@addtoreset{paragraph}{section}
\makeatother
% to reset headwidth and footwidth
\usepackage[
  headwidth=\the\textwidth+\secnumindent:-\secnumindent,
  footwidth=head:-\secnumindent,
  headsepline,% to show the headwidth
  footsepline% to show the footwidth
]{scrlayer-scrpage}

\usepackage{lscape}
%
% AND NOW WE BEGIN
%
\begin{document}
\section{Section}
\subsection {Subsection}\label{sec:first}
\p \blindtext
% a reference
\p See \ref{sec:first}
% an example numbered paragraph with an embedded list
\p \blindtext
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
and some words at the end of this para

% an example numbered paragraph with a simple equation
\p The period is defined by a pair of days ($D_l$, $D_u$) where 
\begin{align*}
D_{l} & =  \text{the lower date}  \\
D_{u} & =  \text{the upper date}
\end{align*}
and things happen for all days $d$ where $D_l <= d< D_u$. 
\section{Next section}
\subsection{Next subsection}
\p \blindtext
\clearpage
\addtolength\hoffset{-\secnumindent}
\addtolength\textwidth{\secnumindent}
\KOMAoptions{headwidth=text,footwidth=head}
\begin{landscape}
  \Blindtext[10]
\end{landscape}
\end{document}

上面的代码适用于版本 3.15 或更新版本如果你插入

% make sure that it also works with KOMA 3.15 or 3.16
\renewcommand\othersectionlevelsformat[3]{\parbox{\secnumindent}{#3\autodot}}
\providecommand\sectionformat{}\providecommand\subsectionformat{}
\providecommand\subsubsectionformat{}\providecommand\paragraphformat{}

在重新定义\sectionformatetc.之前


代碼KOMA-Script 版本 3.12 或更新版本

\documentclass[english, parskip=full, fontsize=11, DIV12, toc=left, numbers=noenddot]{scrartcl}
\usepackage{babel}
\usepackage{amsmath}
% just so we can see what is going on for now
%\usepackage{showframe}
\usepackage{blindtext}% dummy text
% tighten up spacing of lists
\usepackage{enumitem}
\setlist{noitemsep}

\setcounter{secnumdepth}{4}
\renewcommand\theparagraph{\thesubsection.\arabic{paragraph}}
\newcommand\p{\paragraph{}\hspace*{-1em}}

\newcommand\secnumindent{1.5cm}
\renewcommand\othersectionlevelsformat[3]{\makebox[0pt][r]{\parbox{\secnumindent}{#3\autodot}}}
% to make sure that it works with version 3.17 or newer:
  \let\sectionformat\relax\let\subsectionformat\relax
  \let\subsubsectionformat\relax\let\paragraphformat\relax
%
% from the answer of @Steven:
\addtolength\hoffset{\secnumindent}
\addtolength\textwidth{-\secnumindent}
% to reset headwidth and footwidth
\usepackage[
  headwidth=\the\textwidth+\secnumindent:-\secnumindent,
  footwidth=head:-\secnumindent,
  headsepline,% to show the headwidth
  footsepline% to show the footwidth
]{scrlayer-scrpage}
%
% make sure paragraphs reset counting at section and subsections
%
\makeatletter
\@addtoreset{paragraph}{subsection}
\@addtoreset{paragraph}{section}
\makeatother
%
\usepackage{lscape}
%
% AND NOW WE BEGIN
%
\begin{document}
\section{Section}
\subsection {Subsection}\label{sec:first}
\p \blindtext
% a reference
\p See \ref{sec:first}
% an example numbered paragraph with an embedded list
\p \blindtext
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
and some words at the end of this para

% an example numbered paragraph with a simple equation
\p The period is defined by a pair of days ($D_l$, $D_u$) where 
\begin{align*}
D_{l} & =  \text{the lower date}  \\
D_{u} & =  \text{the upper date}
\end{align*}
and things happen for all days $d$ where $D_l <= d< D_u$. 
\section{Next section}
\subsection{Next subsection}
\p \blindtext
% inserted
\clearpage
\addtolength\hoffset{-\secnumindent}
\addtolength\textwidth{\secnumindent}
\KOMAoptions{headwidth=text,footwidth=head}
\begin{landscape}
  \Blindtext[10]
\end{landscape}
\end{document}

相关内容