0

I would like insert a sidebar (colored with text) on certain page. I searched for a while but couldn't find anything.

\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}

It sould look like this (the text should not be under the side bar ;) )

enter image description here

1

Here is a suggestion using scrlayer to define a new page style for this page(s):

enter image description here

\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}

Note that it is still possible to use fancyhdr for the page styles on the other pages.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.