Fonts & Character SetsSetting up a New document - Layout

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Christoph
Posts: 29
Joined: Tue Mar 22, 2022 5:22 pm

Setting up a New document - Layout

Post by Christoph »

Hello

I´m trying to setup a template for a technical report.
Here the Text I´ve written so far.
I´ve problems defining \titleformat using the packages
titlesec, titleps, titletoc

As far I´ve realised it´s pretty importent to put in the comands in the right order. Is there any general Guide in how to put in comands in the rigth order?
Is it usually common to write the Layout information in a seperate file? how should this file look like, how to reference to it in my main document?

That´s are a lot of question probably you can refer a good tutorial?

Thanks a lot and
best regards Christoph

Code: Select all

\documentclass[
	paper = a4,
	fontsize = 12pt,
]{report}

\usepackage[
	inner=2cm,
	outer=1cm,
	top=3cm,
%	includehead,
	bottom=2cm,
%	includefoot	
%	includeheadfoot,
]{geometry}

\usepackage{lastpage}
\usepackage[
	headsepline,
	footsepline,
]{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearscrheadfoot

\chead{
	Erste Kopfzeile Projekttitel \\ 
	nähere Beschreibung \\ 
	\textbf{Art des Projekts}
}

\ifoot{Auftragsnummer}
\ofoot{
	Seiten \pagemark von \pageref{LastPage}
}

\usepackage{titlesec}
\usepackage{titleps}
\usepackage{titletoc}

\titleformat{\section}[frame]{\itshape}


\begin{document}


	
\section{Allgemeine Angaben}
Small is beautiful.

\subsection{Konsensinhaber}
dfsfsadf

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Setting up a New document - Layout

Post by Bartman »

Please refer to the titlesec manual to find out what different types of \titleformat commands there are and what arguments they have.

The options specified when loading the class match a komascript class, but not a standard class.

Your example could look like this with the equivalent of KOMA-Script (is also available in German).

Code: Select all

\documentclass[
%  paper=a4,% default setting
  fontsize=12pt
]{scrreprt}

\usepackage[
  inner=2cm,
  outer=1cm,
  top=3cm,
  bottom=2cm,
  head=43.5pt% added because of the scrlayer-scrpage warning in the log file
]{geometry}
\usepackage{lastpage}
\usepackage[
  headsepline,
  footsepline,
]{scrlayer-scrpage}
%\pagestyle{scrheadings}% loaded by scrlayer-scrpage

% The command is deprecated. 
% Read the scrlayer-scrpage warning in the log file.
%\clearscrheadfoot
\clearpairofpagestyles

\chead{
  Erste Kopfzeile Projekttitel \\ 
  nähere Beschreibung \\ 
  \textbf{Art des Projekts}
}

\ifoot{Auftragsnummer}
\ofoot{Seiten \pagemark{} von \pageref{LastPage}}

\setkomafont{disposition}{\bfseries}
\addtokomafont{section}{\itshape}
\setkomafont{pagenumber}{\slshape}

\begin{document}
\section{Allgemeine Angaben}
Small is beautiful.

\subsection{Konsensinhaber}
dfsfsadf
\end{document}
As you can see from the numbering of the outline levels, this class type supports chapters. It's up to you to decide if you want to use chapters for your document type or if sections will suffice.

I don't know if the content of the introduction is enough for you, but it can't hurt to browse through it.
Christoph
Posts: 29
Joined: Tue Mar 22, 2022 5:22 pm

Setting up a New document - Layout

Post by Christoph »

Hallo,

Thank you Bartman! You´r Input got me a bit farther.

My actual Problem is that the changes of the headings let disappear the header and footer. Probably because KOMS-script is not compatible with titlesec...

Apart from that my next target will be to get a horizontal line beneath the section-Title and to add an additional number for the subsubsection level eg: "2.4.2.1. Subsection"...

Best regards Christoph

Code: Select all

\documentclass[
%	paper=a4,
	fontsize=12pt,
]{scrreprt}

\usepackage{tgadventor}
\renewcommand*\familydefault{\sfdefault} % Only if the base font of the document is to be sans serif
\usepackage[T1]{fontenc}

%\usepackage[latin1]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage{ngerman}
%\usepackage[scaled]{uarial}

%\usepackage[T1]{frontec} 
%\usepackage[utf8]{inputenc}
%\usepackage{QTAvanti}
%\setmainfont{QTAvanti}

\usepackage[
	inner=2cm,
	outer=1cm,
	top=3cm,
%	includehead,
	bottom=2cm,
%	includefoot	
%	includeheadfoot,
	head=43.5pt
]{geometry}

\usepackage{lastpage}
\usepackage[
	headsepline,
	footsepline,
]{scrlayer-scrpage}
%\pagestyle{scrheadings} %Wird bereits mitscrlayer-scrpage mitgeladen
\clearpairofpagestyles

\renewcommand*{\headfont}{\normalfont}

\chead{
	Erste Kopfzeile Projekttitel \\ 
	nähere Beschreibung \\ 
	\textbf{Art des Projekts}
}

\ifoot{Auftragsnummer}
\ofoot{
	Seiten \pagemark von \pageref{LastPage}
}

\usepackage{titlesec}
%\usepackage{titleps} %Nicht gemeinsam mit KOMA-script class empfohlen
\usepackage{titletoc}


%\renewcommand*{\thesection}{\thesection.}
%\renewcommand*{\thesubsection}{\thesubsection.}
%\renewcommand*{\thesubsubsection}{\thesubsection\arabic{subsubsection}.}


\titleformat{\chapter}
[frame]
{\normalfont}
{}
{8pt}
{\Large\bfseries\thechapter\enspace\MakeUppercase}

\titleformat{\section}
	[frame]
	{\normalfont}
	{}
	{8pt}
	{\Large\bfseries\thesection\enspace\MakeUppercase}[]

\titleformat{\subsection}
	[frame]
	{\normalfont}
	{}
	{8pt}
	{\Large\bfseries\thesubsection\enspace}

\titleformat{\subsubsection}
	[frame]
	{\normalfont}
	{}
	{8pt}
	{\Large\bfseries\thesubsubsection\enspace}

\titleformat{\subsubsection}
[frame]
{\normalfont}
{}
{8pt}
{\Large\bfseries\thesubsection\enspace}

%\setkomafont{disposition}{\bfseries}
%\addtokomafont{section}{\framebox[4cm][l], \itshape}
%\setkomafont{pagenumber}{\slshape}

%\setcounter{secnumdepth}{3}

\begin{document}


	
\chapter{Allgemeine Angaben}
Small is beautiful. Ä Ü Ö äüö

\section{Konsensinhaber}
dfsfsadf

\subsection{Subsection}

\subsubsection{Subsubsection}

%\paragraph{Absatz}

\end{document}
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Setting up a New document - Layout

Post by Bartman »

It's indeed not advisable to use titlesec (or the other two) with a KOMA-Script class. These classes have their own commands, e.g. \chapterlinesformat and \sectionlinesformat to add a frame and capitalise some outline levels.

The header and footer don't appear because the first page of a chapter is set in plain style. Furthermore, the \clear... command in the preamble deletes the footer. This can be done either by altering the \chapterpagestyle command or by using the starred version of the commands to define the contents of the headers and footers.

\headfont is a command of the outdated scrpage2 package. At least one element in table 3.2 in section 3.6 "Text Markup" is now used to do this.

By the way, I added the braces after \pagemark in the footer to get a space between the current page number and the following word.
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Setting up a New document - Layout

Post by Bartman »

Christoph wrote:add an additional number for the subsubsection level eg: "2.4.2.1. Subsection"...
Try to remove the last \titleformat command and use the commented out adjustment of the secnumdepth counter.
User avatar
MjK
Posts: 89
Joined: Fri Jan 28, 2022 6:09 pm

Setting up a New document - Layout

Post by MjK »

BTW: For frames around part or chapter headings I've already added an example with \fcolorbox resp. \colorbox to the KOMA-Script manual (see chapter 21). You can simply replace the \fcolorbox resp. \colorbox by \framebox or \fbox (or even by a command or environment of famous package tcolorbox).

And for Germans there are also examples at »Emulation von fncychap mit KOMA-Script-Mitteln«. Sorry for those who do not understand German, these pages have not yet been converted to the English headings section in the KOMA-Script Wiki (which is allso available in German) and therefore have not yet been translated. And sorry there are currently more than 90 todo notes in the KOMA-Script sources and big fat todo in the developer tracker. So I'm afraid, but I do not expend to find the time to do this myself this year (and so maybe not before the current version of komascript.de will be closed). Contributors are welcome!
My main topics are KOMA-Script and other questions related to my packages. If I reply to any other topic or if you've not yet added a minimal working example, please do not expect any further response. And please don't forget to tag examples as code.
Christoph
Posts: 29
Joined: Tue Mar 22, 2022 5:22 pm

Setting up a New document - Layout

Post by Christoph »

OK, replacing the outdated command \headfont was easy - my abilities where just well enough ;-)

Code: Select all

%\renewcommand*{\headfont}{\normalfont} %% outdated command
\setkomafont{pageheadfoot}{\normalfont}
Christoph
Posts: 29
Joined: Tue Mar 22, 2022 5:22 pm

Setting up a New document - Layout

Post by Christoph »

To add the footer and header also at pages with a new chapter (chapterpage) i first tried bartman recomanatation to use the starred versions of the commands

Code: Select all

\chead*{
	Erste Kopfzeile Projekttitel \\ 
	nähere Beschreibung \\ 
	\textbf{Art des Projekts}}
\ifoot*{Auftragsnummer}
\ofoot*{
	Seite \pagemark{} von \pageref{LastPage}
}
For the contents of the headers and footers that worked super (Chapter 5, page 280 in the german KOMA-script doku).

BTW: I´ve also added the two braces for the space between current page number and the following word - thanks!
Christoph
Posts: 29
Joined: Tue Mar 22, 2022 5:22 pm

Setting up a New document - Layout

Post by Christoph »

But the head- and footsepline didn´t appear in the plain style of the chapterpage.

Code: Select all

\usepackage[
	headsepline,
	footsepline,
]{scrlayer-scrpage}
So, to add the seplines I tried to redefine the \chapterpagestyle by the following...

Code: Select all

\renewcommand*{\chapterpagestyle}{headings}
At first it wasn´t working and I thought it would be becaus of the following in the KOMA-script doku:
You might think that you can put running heads on the first page of a chapter simply by using
the

Code: Select all

\renewcommand*{\chapterpagestyle}{headings}
command. Before you try this, you should read the remarks on \rightfirstmark starting on
page page 449 in chapter 18, part II
On page 449 there was then the note "only expected for advanced users"

But at the moment it´s working fine. No idea, why it wasn´t before...

I´ve also deleted the "*" because chapterpages aren´t plain-style anymore and ist still works...
Bartman
Posts: 369
Joined: Fri Jan 03, 2020 2:39 pm

Setting up a New document - Layout

Post by Bartman »

In addition to the already used options for horizontal lines, there are also those for the plain page style. You can find them in section 5.5. Manipulating Page Styles.
Post Reply