如何使用 scrlayer-scrpage 查找宏来调整页脚(lefoot、cefoot 等)

如何使用 scrlayer-scrpage 查找宏来调整页脚(lefoot、cefoot 等)

我仍在为我的机构制作 Latex 模板。到目前为止,一切运行良好,我之前在这里提出的问题对我帮助很大。

现在,我想调整期刊页脚的不同部分以满足预期的布局。我有一个可行的解决方案,使用\parbox我的等命令,使页脚内容按需要显示。如果有多个作者\lofoot\cofoot作者应出现在左侧并带有换行符,标题应始终出现在作者部分的右侧,也应与文本主体的右边距对齐,如果需要,也带有换行符(请参阅下面的 MWE)。但我仅通过反复试验才算出合适的宽度。事实并非如此(我有点完美主义 ;) )

因此,我想找出scrlayer-scrpage包中的哪些宏定义了这些命令,并调整/更新它们以满足我的需求。但到目前为止,我还没有收到这些信息。

例如,当我latexdef -p scrlayer-scrpage lefoot在终端内运行或\meaning\lefoot在文档中使用时,我得到了短语macro:->\sls@renewelement {even}{left}{foot}。到目前为止,一切都很好,但我无法弄清楚如何找到元素的定义foot(运行latexdeffoot产生了它是,undefined因为foot没有命令,运行它sls@renewelement也没有帮助)。我也在.sty直接运行文件,没有任何结果。如果我{\tracingall\lefoot}在文档中运行,编译过程永远不会结束,而且我在日志中找不到任何信息。

因此,我的问题不仅是关于上述页脚的调整,而且还关于一般的一个是关于在 Latex/Tex 后端进行更深入的工作:如果我需要再次执行此操作,如何获取这些信息 - 而且肯定会是这样,因为我才刚刚开始使用模板。

这是我的 MWE(我故意使用article类而不是 KOMA 类)。我仅将我的解决方法添加到奇数页,以便每个人都能看到布局差异:

\documentclass[a4paper,12pt,
twoside,%
]{article}
\usepackage[T1]{fontenc}


\usepackage{blindtext}

\usepackage{geometry}
\geometry{%
    inner=20mm,
    outer=60mm,
    top=15mm,
    bottom=20mm,
    marginparwidth=45mm,
    showframe % to show the margins
}

\usepackage[footwidth=textwithmarginpar,footsepline=0.4pt:text,ilines]{scrlayer-scrpage}
\clearpairofpagestyles

\ModifyLayer[addvoffset=2.5ex]{scrheadings.foot.odd}
\ModifyLayer[addvoffset=2.5ex]{scrheadings.foot.even}
\ModifyLayer[addvoffset=2.5ex]{scrheadings.foot.oneside}
\ModifyLayer[addvoffset=2.5ex]{plain.scrheadings.foot.odd}
\ModifyLayer[addvoffset=2.5ex]{plain.scrheadings.foot.even}
\ModifyLayer[addvoffset=2.5ex]{plain.scrheadings.foot.oneside}

\setkomafont{pagefoot}{\sffamily\tiny\normalshape}

\ohead*{\pagemark}

\lefoot*{Journal 2000, § 1--4}
\cefoot*{A List of different authors who have written the current article}
\refoot*{\bfseries The title of the current article which was written by the different authors mentioned on the left}

\lofoot*{\parbox[t]{.35\textwidth}{A List of different authors who have written the current article}}
\cofoot*{\hspace*{.13\textwidth}\parbox[t]{.5\textwidth}{\raggedleft\bfseries The title of the current article which was written by the different authors mentioned on the left}}
\rofoot*{Journal 2000, § 1--4}


\begin{document}

\section{Section Heading}
 \blindtext[5]

\end{document}

我相信答案可以通过阅读来理解TeXbook或者TeX 按主题分类或类似的东西,但如果有人能更快回答,我就能节省大量时间。到目前为止,KOMA 脚本文档还不太有帮助。

提前感谢您的有益回复!

编辑

评论中提供的链接非常有用,我发现了很多我需要并且想要阅读的内容,以便更好地理解 Latex。

但具体问题仍未解决,我找不到解决方案。我仍然使用包提供的 ... 命令中的parboxhspace*命令来调整页脚布局。在包中,命令 ie 定义为。lefootscrlayer-scrpage\lefootmacro:->\sls@renewelement {even}{left}{foot}

有没有人能具体回答在哪里可以找到这三个元素的定义,以便我可以重新定义它们以满足我的需要?或者说,改变包树/后端深处的东西通常是一个坏主意吗?

答案1

您可以使用例如。

\lefoot*{Journal 2000, § 1--4}
\refoot*{%
  \parbox[t][\ht\strutbox]{.5\textwidth}{\bfseries The title of the current article which was written by the different authors mentioned on the left}%
  \hspace*{.15\textwidth}%
  \parbox[t][\ht\strutbox]{.35\textwidth}{\raggedleft A List of different authors who have written the current article}%
}

\lofoot*{%
  \parbox[t][\ht\strutbox]{.35\textwidth}{A List of different authors who have written the current article}%
  \hspace*{.15\textwidth}%
  \parbox[t][\ht\strutbox]{.5\textwidth}{\raggedleft\bfseries The title of the current article which was written by the different authors mentioned on the left}%
}
\rofoot*{Journal 2000, § 1--4}

或者

\refoot*{%
  \parbox{\textwidth}{%
    \parbox[t][\ht\strutbox]{.5\linewidth}{\bfseries The title of the current article which was written by the different authors mentioned on the left}%
    \hfill%
    \parbox[t][\ht\strutbox]{.35\linewidth}{\raggedleft A List of different authors who have written the current article}%
}}

\lofoot*{%
  \parbox{\textwidth}{%
    \parbox[t][\ht\strutbox]{.35\linewidth}{A List of different authors who have written the current article}%
    \hfill%
    \parbox[t][\ht\strutbox]{.5\linewidth}{\raggedleft\bfseries The title of the current article which was written by the different authors mentioned on the left}%
}}

例子:

\documentclass[a4paper,12pt,
twoside,%
]{article}
\usepackage[T1]{fontenc}
\usepackage{blindtext}
\usepackage{geometry}
\geometry{%
  inner=20mm,
  outer=60mm,
  top=15mm,
  bottom=20mm,
  marginparwidth=45mm,
  showframe % to show the margins
}

\usepackage[footwidth=textwithmarginpar,footsepline=0.4pt:text,ilines]{scrlayer-scrpage}
\clearpairofpagestyles

\ModifyLayer[addvoffset=2.5ex]{scrheadings.foot.odd}
\ModifyLayer[addvoffset=2.5ex]{scrheadings.foot.even}
\ModifyLayer[addvoffset=2.5ex]{scrheadings.foot.oneside}
\ModifyLayer[addvoffset=2.5ex]{plain.scrheadings.foot.odd}
\ModifyLayer[addvoffset=2.5ex]{plain.scrheadings.foot.even}
\ModifyLayer[addvoffset=2.5ex]{plain.scrheadings.foot.oneside}

\setkomafont{pagefoot}{\sffamily\tiny\normalshape}

\ohead*{\pagemark}
\ofoot*{Journal 2000, § 1--4}

\refoot*{%
  \parbox[t][\ht\strutbox]{.5\textwidth}{\bfseries The title of the current article which was written by the different authors mentioned on the left}%
  \hspace*{.15\textwidth}%
  \parbox[t][\ht\strutbox]{.35\textwidth}{\raggedleft A List of different authors who have written the current article}%
}

\lofoot*{%
  \parbox[t][\ht\strutbox]{.35\textwidth}{A List of different authors who have written the current article}%
  \hspace*{.15\textwidth}%
  \parbox[t][\ht\strutbox]{.5\textwidth}{\raggedleft\bfseries The title of the current article which was written by the different authors mentioned on the left}%
}

\begin{document}
\section{Section Heading}
\blindtext[5]
\end{document}

您还可以使用默认的 footwidth=text 并为页脚中的 marginpar 声明附加层。然后就可以使用 \ifoot* 和 \ofoot* 来对齐与文本对齐的条目。

答案2

为了完整起见,我在这里发布了我目前的解决方案。上周我使用了@esdd 的答案。但最终,我需要采用另一种解决方案,因为所需的文档布局会改变文档内部的几何形状,从而破坏了页脚的调整。

我尝试了很多不同的方法,但最终决定不使用scrlayer-scrpage 诸如\lofoot{}etc 之类的包提供的标准选项。相反,我声明了一些使用标准几何图形的关系的新图层\linewidth\textwidth因此,调用后页脚不会改变其布局\newgeometry

现在我使用以下代码,并且它运行良好;无论如何调整几何形状:

\documentclass[%
twoside,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{noto}

\usepackage{geometry}
\geometry{%
    inner=20mm,
    outer=60mm,
    top=15mm,
    bottom=20mm,
    marginparwidth=40.5mm,
    marginparsep=4.5mm,
    showframe % to show the margins
}

\usepackage{multicol}

\usepackage[]{scrlayer-scrpage}
\clearpairofpagestyles
\usepackage{xcolor}
%% Footer content %%
\DeclareNewLayer[
background,
twoside,
oddpage,
foot,
width=\textwidth+\marginparsep+\marginparwidth,
voffset=1in+\topmargin+\headsep+\textheight+\footskip+.6\footnotesep,
contents={\sffamily\tiny\normalshape%
    \parbox[b]{.743\linewidth}{%
    \parbox[b]{.35\linewidth}{\color{red}A\rule{\linewidth}{2pt}}%
    \hfill%
    \parbox[b]{.5\linewidth}{\color{green}\rule{\linewidth}{2pt}\raggedleft}%
    }%
    \hfill%
    \parbox[b]{.2\linewidth}{\color{blue}Journaltitle 1--12\raggedleft}%
    }
]{oddfootercontent}
\DeclareNewLayer[
clone=oddfootercontent,
evenpage,
hoffset=\evensidemargin+1in-\marginparsep-\marginparwidth,
contents={\sffamily\tiny\normalshape%
    \parbox[b]{\linewidth}{%
    \parbox[b]{.2\linewidth}{\color{blue}Journaltitle 1--12}%
    \hfill
    \parbox[b]{.743\linewidth}{%
        \parbox[b]{.35\linewidth}{\color{red}\rule{\linewidth}{2pt}}%
        \hfill%
        \parbox[b]{.5\linewidth}{\color{green}\rule{\linewidth}{2pt}\raggedleft}%
    }
    }
    }
]{evenfootercontent}
%% pagenumber at bottom of outsidemargin %%
\DeclareNewLayer[
background,
oneside,
outermargin,
height=\textheight,
voffset=1in+\voffset+\topmargin+\headheight+\headsep+.8\footnotesep,
contents={%
    \parbox[b][\layerheight][b]{\layerwidth}
    {\raggedleft\hfill\pagemark\hspace*{15mm}}%
}
]{outermargin.pagenumber.oneside}
\DeclareNewLayer[
clone=outermargin.pagenumber.oneside,
twoside,
oddpage
]{outermargin.pagenumber.odd}
\DeclareNewLayer[
clone=outermargin.pagenumber.odd,
evenpage,
contents={%
    \parbox[b][\layerheight][b]{\layerwidth}
    {\hspace*{15mm}\pagemark\hfill}%
}
]{outermargin.pagenumber.even}
\AddLayersToPageStyle{scrheadings}{%
    oddfootercontent,%
    evenfootercontent,%
    outermargin.pagenumber.oneside,%
    outermargin.pagenumber.odd,%
    outermargin.pagenumber.even%
}
\AddLayersToPageStyle{plain.scrheadings}{%
    oddfootercontent,%
    evenfootercontent,%
    outermargin.pagenumber.oneside,%
    outermargin.pagenumber.odd,%
    outermargin.pagenumber.even%
}
\setkomafont{pagenumber}{\sffamily\bfseries}
\usepackage[%
hang,%
bottom%
]{footmisc}
\setlength{\footnotemargin}{0.5cm}
\setlength{\skip\footins}{0,5cm}
\makeatletter
\renewcommand\footnoterule{\kern-3\p@
        \hrule \@width \textwidth \kern 2.6\p@}
\makeatother

\usepackage{blindtext}

\begin{document}
    \section{Autoren}
    \blindtext\footnote{text}
    
    \blindtext[6]\footnote{text}
    
    \blindtext[2]

    \newgeometry{
    inner=20mm,
    outer=37.5mm,
    top=15mm,
    bottom=20mm,
    marginparwidth=18mm,
    marginparsep=4.5mm
    }
    \begin{multicols}{2}
        \section{newgeometry}       
        \blindtext[3]\footnote{text}
        
        \blindtext[6]
    \end{multicols}
\end{document}

尽管如此,@esdd 的回答为我提供了第一个解决方案,以及我自己的解决方案所依赖的概念。因此,它仍然是答案解决了这个问题。

谢谢

相关内容