![Beamer 喜欢文章中的侧边栏](https://linux22.com/image/314859/Beamer%20%E5%96%9C%E6%AC%A2%E6%96%87%E7%AB%A0%E4%B8%AD%E7%9A%84%E4%BE%A7%E8%BE%B9%E6%A0%8F.png)
我想在某个页面上插入一个侧边栏(带有文字)。我搜索了一段时间,但没有找到任何东西。
\documentclass{article}
\usepackage{geometry}
\geometry{
a4paper,
total={210mm,297mm},
left=25mm,
right=40mm,
top=40mm,
bottom=25mm,
}
\usepackage{boxedminipage}
% turn off indentation
\usepackage{parskip}
% german spelling
\usepackage[ngerman]{babel}
% set font encoding
\usepackage[T1]{fontenc}
\usepackage{xcolor}
% set fonts
\usepackage{xltxtra}
%\usefonttheme{professionalfonts}
\setsansfont[
BoldFont={Helvetica Neue Medium},
ItalicFont={Helvetica Neue Italic},
BoldItalicFont={Helvetica Neue Medium Italic},
Ligatures=TeX
]{Helvetica Neue Light}
\setmonofont[Scale=0.9]{Menlo Regular}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{blindtext}
\begin{document}
\blindtext
\end{document}
它应该看起来像这样(文本不应该在侧边栏下;))
答案1
scrlayer
以下是为此页面定义新页面样式的建议:
\documentclass{article}
\usepackage{geometry}
\geometry{
a4paper,
%total={210mm,297mm},
left=25mm,
right=40mm,
top=40mm,
bottom=25mm,
}
\usepackage{boxedminipage}
\usepackage{parskip}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{geometry}
\usepackage{xltxtra}
%\setsansfont[
%BoldFont={Helvetica Neue Medium},
%ItalicFont={Helvetica Neue Italic},
%BoldItalicFont={Helvetica Neue Medium Italic},
%Ligatures=TeX
%]{Helvetica Neue Light}
%\setmonofont[Scale=0.9]{Menlo Regular}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{scrlayer}
\DeclareNewLayer[
background,
outermargin,
addhoffset=\marginparsep,
contents={\color{blue!20}\rule{\layerwidth}{\layerheight}}
]{sidebar.bg}
\makeatletter
\DeclareNewLayer[
clone=sidebar.bg,
addhoffset=1em,
addwidth=-1em,
contents={\parbox[b][\layerheight]{\layerwidth}{\raggedright\@sidebar}}
]{sidebar.txt}
\newcommand\@sidebar{}
\newcommand\sidebar[1]{\renewcommand\@sidebar{#1}}
\makeatother
\DeclareNewPageStyleByLayers{sidebar}{sidebar.bg,sidebar.txt}
\usepackage{blindtext}
%\usepackage{fancyhdr}\pagestyle{fancy}
\begin{document}
\newgeometry{right=5cm}
\thispagestyle{sidebar}
\sidebar{%
\vspace{1em}
\includegraphics[width=\linewidth]{example-image.pdf}\par
\vspace{1cm}
\pagename~\pagemark
\vfill
Hier steht noch etwas anderes
\par\vspace*{1em}
}
\blindtext
\cleardoublepage
\restoregeometry
\blinddocument
\end{document}
请注意,它仍然可以用于fancyhdr
其他页面上的页面样式。