0

Does anyone know how I can make this document have this header only on the first page and not on the other pages? Also, the inserted program code "Form1.cs" should start on the first page. enter image description here enter image description here

\input{configuration.tex}
\begin{document}
\thispagestyle
\newcommand{\obenzentral}{\large{Hausaufgabe}\\ 
\Large{Wirtschaftsinformatik}}
\newcommand{\rechts}{\textcolor{gray}{\small{Ardit Abrashi}}}

\subsection*{MwSt-Rechner}
\begin{center}
  \includegraphics{Unbenannt.png}
\end{center} 
\subsection*{Code des Programms}

\lstinputlisting[language=c]{Form1.cs}

\end{document}


Preamble:



\documentclass[%
 paper=a4,       
 fontsize=10pt,  
 ngerman         
 ]{scrartcl}


 \usepackage[final]{graphicx}         
 \usepackage{subcaption}
 \usepackage{babel}                    
 \usepackage[german=quotes]{csquotes}  
 \enquote{...}



 \usepackage{sourcecodepro}
 \usepackage[default]{sourcesanspro}
 \usepackage{nimbusmononarrow}

 \usepackage[babel=true,final,tracking=smallcaps]{microtype}
 \DisableLigatures{encoding = T1, family = tt* }   




 \usepackage[usenames,x11names,final]{xcolor}



 \usepackage{mathtools}            
 \usepackage{amssymb}              
 \usepackage[bigdelims]{newtxmath} 
 \allowdisplaybreaks                
 \usepackage{bm}                    
 \usepackage{wasysym}               
 \usepackage{bbm}              




 \usepackage{tikz}
 \usetikzlibrary{arrows,arrows.meta}   
 \usetikzlibrary{calc}                 
 \usetikzlibrary{positioning}
 \tikzset{>=Latex}                   




 \usepackage{scrlayer-scrpage}
 \usepackage[top=3cm, bottom=3cm, left=2.5cm, right=2cm]{geometry}

 \clearscrheadfoot 
 \setheadsepline{0.4pt}                        
 \setfootsepline{0.4pt}                            
 \setkomafont{pagehead}{\bfseries}                 
 \setkomafont{pagefoot}{\normalfont\footnotesize}  

 \rohead{\rechts}
 \cohead{\obenzentral}                         
 \raggedbottom                                  
 \usepackage{setspace}                          
 \onehalfspacing                                   
 \setlength{\parindent}{0pt}                      
 \setlength{\parskip}{0.5\baselineskip}            





 \usepackage[%
 hidelinks,
 pdfpagelabels,
 bookmarksopen=true,
 bookmarksnumbered=true,
 linkcolor=black,
 urlcolor=SkyBlue2,
 plainpages=false,
 pagebackref,
 citecolor=black,
 hypertexnames=true,
 pdfborderstyle={/S/U},
 linkbordercolor=SkyBlue2,
 colorlinks=false,
 backref=false]{hyperref}
 \hypersetup{final}



 \usepackage{multicol}
 \usepackage[shortlabels]{enumitem}
 \setlist{itemsep=0pt}
 \setlist[enumerate]{font=\sffamily\bfseries}
 \setlist[itemize]{label=$\triangleright$}
 \usepackage{tabularx}



 \usepackage{listingsutf8}
 \lstset{
 belowcaptionskip=1\baselineskip,
 breaklines=true,
 showstringspaces=false,
 basicstyle=\ttfamily,
 keywordstyle=\bfseries\color{green!40!black},
 commentstyle=\itshape\color{purple!40!black},
 stringstyle=\color{orange},
 numbers=left,
 numberstyle=\footnotesize\ttfamily\color{gray},
 inputencoding=utf8/latin1,
 tabsize=4,
 }



 \newcommand{\BB}{\mathbb{B}}
 \newcommand{\CC}{\mathbb{C}}
 \newcommand{\NN}{\mathbb{N}}
 \newcommand{\QQ}{\mathbb{Q}}
 \newcommand{\RR}{\mathbb{R}}
 \newcommand{\ZZ}{\mathbb{Z}}
 \newcommand{\oh}{\mathcal{O}}

 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\wt}[1]{\widetilde{#1}}
 \newcommand{\wh}[1]{\widehat{#1}}

 \DeclareMathOperator{\id}{id}                       
 \DeclareMathOperator{\pot}{\mathcal{P}}             


 \DeclarePairedDelimiter{\absolut}{\lvert}{\rvert}    
 \DeclarePairedDelimiter{\ceiling}{\lceil}{\rceil}    
 \DeclarePairedDelimiter{\Floor}{\lfloor}{\rfloor}   
 \DeclarePairedDelimiter{\Norm}{\lVert}{\rVert}       
 \DeclarePairedDelimiter{\sprod}{\langle}{\rangle}    
 \DeclarePairedDelimiter{\enbrace}{(}{)}              
 \DeclarePairedDelimiter{\benbrace}{\lbrack}{\rbrack} 
 \DeclarePairedDelimiter{\penbrace}{\{}{\}}           
 \newcommand{\Underbrace}[2]{{\underbrace{#1}_{#2}}} 


 \newcommand{\abs}[1]{\absolut*{#1}}
 \newcommand{\ceil}[1]{\ceiling*{#1}}
 \newcommand{\flo}[1]{\Floor*{#1}}
 \newcommand{\no}[1]{\Norm*{#1}}
 \newcommand{\sk}[1]{\sprod*{#1}}
 \newcommand{\enb}[1]{\enbrace*{#1}}
 \newcommand{\penb}[1]{\penbrace*{#1}}
 \newcommand{\benb}[1]{\benbrace*{#1}}
 \newcommand{\stack}[2]{\makebox[1cm][c]{$\stackrel{#1}{#2}$}}
1
  • 3
    Please note that \large, \small, etc. aren't macros taking arguments but switches. The correct usage would be {\large Large Text}. – Skillmon Oct 29 '20 at 14:16
1

In the following I removed everything unrelated.

You could define a page style extra for the first page and use that with \thispagestyle. The remaining pages will then use the default page style.

\documentclass[%
 paper=a4,       
 fontsize=10pt,  
 ngerman         
 ]{scrartcl}

\usepackage[]{graphicx}
\usepackage{xcolor}

\usepackage{scrlayer-scrpage}

% not doing this will keep the page numbers etc. on the second page
%\clearscrheadfoot 
\setheadsepline{0.4pt}                        
\setfootsepline{0.4pt}                            
\setkomafont{pagehead}{\bfseries}                 
\setkomafont{pagefoot}{\normalfont\footnotesize}  

\newpairofpagestyles{firstpage}
  {%
    \rohead{{\large Hausaufgabe}\\{\Large Wirtschaftsinformatik}}%
    \cohead{\textcolor{gray}{{\small Ardit Abrashi}}}%
  }

% just for dummy content
\usepackage{duckuments}

\begin{document}
\thispagestyle{firstpage}

\subsection*{MwSt-Rechner}
\begin{center}
  \includegraphics{example-image-duck}
\end{center} 
\subsection*{Code des Programms}

\blindduck[all]
\blindduck[all]

\end{document}

enter image description here

enter image description here

1

You could also use page style scrheadings for the first page and plain for all the other pages.

\PassOptionsToPackage{head height=27pt}{typearea}% removes the warning regarding the head height

%--- your preamble without the unrelated stuff:
\documentclass[%
  %paper=a4,% default
  fontsize=10pt,
  parskip=half-,% do not change \parskip and \parindent manually!
  ngerman,
  ]{scrartcl}
\usepackage{babel}

\usepackage{graphicx}
\usepackage{xcolor}

\usepackage[
  manualmark,
  headsepline=0.4pt,% do not use outdated macro \setheadsepline
  footsepline,% do not use outdated macro \setheadsepline
  plainfootsepline
  ]{scrlayer-scrpage}% sets page style scrheadings automatically

\pagestyle{plain}% plain style for all pages except first page

\clearpairofpagestyles% replaces outdated \clearscrheadfoot
\cfoot*{\pagemark}% pagemark in the center of the footer

\newcommand*\obenzentral[1]{\chead{#1}}
\newcommand*\rechts[1]{\rohead{#1}}

\setkomafont{pagehead}{\bfseries}
\setkomafont{pagefoot}{\normalfont\footnotesize}
%---

\obenzentral{%
  {\large Hausaufgabe}\\ 
  {\Large Wirtschaftsinformatik}%
}
\rechts{\textcolor{gray}{\small Ardit Abrashi}}

\usepackage{blindtext}% only for dummy text

\begin{document}

\thispagestyle{scrheadings}% page style scrheadings on first page
\subsection*{MwSt-Rechner}
\begin{center}
  \includegraphics{example-image}
\end{center} 

\subsection*{Code des Programms}
\Blindtext
\end{document}

enter image description here

If there should be a headsepline on all pages add plainheadsepline to the scrlayer-scrpage options.

Additional remarks:

Do not use \setheadsepline to switch on the headsepline. It is an outdated scrpage2 macro. Use option headsepline=0.4pt instead or simple option headsepline because 0.4pt is the default width.

Do not change \parindent and \parsep manually. You could use option parskip=half or parskip=half-.

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.