%Main language styles and foreign characters \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[ngerman,british]{babel}%default language of the document is the last language in the options. Can change this for a single section (e.g. abstract) with \begin{otherlanguage}{ngerman} \frenchspacing%avoid double whitespace after ``.'', usefull in abbreviations e.g. ``e.g.'' \usepackage[english=british]{csquotes} %Layout %control pagebeaks around \part and \chapter %https://tex.stackexchange.com/questions/419404/scrbook-part-and-chapter-on-same-page \RedeclareSectionCommand[ beforeskip=\dimexpr-3.3\baselineskip-\parskip\relax, afterskip=\dimexpr3.3\baselineskip+\parskip\relax, style=chapter% no part page ]{part} \renewcommand\partformat{\partname\ \thepart\autodot\enskip} %\DeclareNewSectionCommand[ %beforeskip=-1sp, %afterskip=1.725\baselineskip plus .115\baselineskip minus .192\baselineskip, %style=section,% no page break before \firstchapterinpart %level=\chapternumdepth, %indent=0pt, %tocindent=0pt, %tocnumwidth=1.5em, %font=\usekomafont{chapter}, %tocstyle=chapter %]{firstchapterinpart} %\makeatletter %\let\c@firstchapterinpart\c@chapter% use the same counter for both chapter and firstchapterinpart %\def\cl@firstchapterinpart{\cl@chapter}% use the same reset list as chapter %\makeatother %having trouble with the texstudio structure view for \firstchapterinpart. Output, including TOC, is okay, but hyperlinks (\cref) also fail, so it is not simply just an inconvenience. May be related to: https://github.com/texstudio-org/texstudio/issues/3086. Found a workaround by combining normal \chapter commands with relaxing of pagebreaks for the first chapter in a part, see https://tex.stackexchange.com/questions/131460/remove-pagebreak-after-a-chapter-only-for-one-chapter % %%(too) heavy-hitting customization of section formatting %%https://tex.stackexchange.com/questions/42526/how-to-remove-page-break-after-part-in-report-book %%in combination with %%https://ctan.math.washington.edu/tex-archive/macros/latex/contrib/standardsectioning/standardsectioning.pdf \usepackage{layout}%print layout dimensions (see example). Nice to know when creating figures \usepackage{layouts}%use preferred units when printing layout dimensions. Example: %\printinunitsof{mm}\prntlen{\textwidth}. Use after begin{document} \usepackage[showframe=false, outer=2.78cm, inner=3.52cm]{geometry}%draw lines around the important areas of each page. Good to check for overfull horizontal boxes. %get margins %https://tex.stackexchange.com/questions/537078/how-to-access-geometry-length \usepackage{ifoddpage}% subsequent commands need the siunitx package. If you use the code from the steckexchange link, be sure not to keep the siunitx package options given there for your final version, otherwise all values of the \SI command will be given with the specified (two-decimal) precision, which sucks if you cannot make such a precise statement or only wanted to get a consistently formatted order of magnitude. Made this mistake and got over-precise polymer content (\SI{4}{\wtpercent} yielded "4.00 wt%" instead of "4 wt%") or completely wrong output (\SI{e7}{\hertz} yielded ".0010^7 Hz" instead of "10^7 Hz"). \makeatletter % Macro for nicely printing a length in centimeters. You don't need it to *use* the lengths. \newcommand*{\convertToCm}[1]{% \begingroup \edef\tmp{\strip@pt\dimexpr(#1)/7227*254\relax}% \SI{\tmp}{\centi\meter}% \endgroup } \makeatother \newlength{\myLeftMargin} \newlength{\myRightMargin} \newcommand*{\myComputeMargins}{% To be called just after \checkoddpage \setlength{\myLeftMargin}{% \dimexpr 1in + \ifoddpage\oddsidemargin\else\evensidemargin\fi \relax}% \setlength{\myRightMargin}{% \dimexpr \paperwidth - \textwidth - \myLeftMargin \relax}% } \newcommand*{\myMarginCheck}{%this command did not differentiate between even and odd page for me, but was nonetheless useful to figure out how large the margin is \checkoddpage\myComputeMargins This is an \ifoddpage odd\else even\fi\ page. The left margin is thus an \ifoddpage inner\else outer\fi\ one and its width is \the\myLeftMargin, that is \convertToCm{\myLeftMargin}. The right margin is \the\myRightMargin, that is \convertToCm{\myRightMargin}.\par } \usepackage[grid=false,gridBG=true]{eso-pic}%draw a grid to precisely place elements. I think I didn't use it in the end %avoid single empty lines (called widows and orphans) on paragraph- or pagestart and -end \clubpenalty=10000% penalizes orphans \widowpenalty=10000% penalizes widows \displaywidowpenalty=10000% penalizes widows that are immediately followed by a formula \[ ... \] \usepackage{microtype}%supposedly more visually appealing borders of the textblocks%needs scalable fonts, therefore may not work on all machines. However, it deals well with (avoiding) line breaks and keeping the margins e.g. for macros like \EtOHDTwoChemHighlight \usepackage[parfill]{parskip}%controls indentation after linebreak and todonotes. https://tex.stackexchange.com/questions/74170/have-new-line-between-paragraphs-no-indentation %Figures and Images \usepackage{chngpage}%wide images %if you want to mess with defaults: %\hfuzz=100pt % suppress warnings %\begin{adjustwidth}{-\evensidemargin-0.8in}{-\rightmargin}%or \oddsidemargin and \leftmargin % \includegraphics[width=0.92\paperwidth]{path} %\end{adjustwidth} %\hfuzz=0pt \usepackage{floatpag}%full page images. Package provides commad \thisfloatpagestyle to remove header and footer. Use this command after \begin{figure}. \usepackage{placeins}%provides command \FloatBarrier. Prevents floats from moving past the command and can therefore force latex to place (multiple) figures where you want them \usepackage{wrapfig}%figure surrounded by text. Ended up not using it. \usepackage{graphicx}%showframe option can be usedto visualize e.g. spacing between images in a \subfloat. The showframe option should be removed in the final version. Moreover, includegraphics options 'trim=left bottom right top' and 'clip' can be used to crop an image (see https://texblog.org/2012/02/23/crop-figures-with-includegraphics/), e.g. \includegraphics[trim=1200 400 1500 1500,clip,width=\textwidth]{crab}. see also: https://tex.stackexchange.com/questions/57418/crop-an-inserted-image. trim option can be complemented by the adjustbox package to access relative units of the image such as "\width". In this case, replace \includegraphics by \adjincludegraphics. \usepackage{caption} \DeclareCaptionStyle{wrapfigcapstyle}{format=plain, indention=0pt} \usepackage{subcaption}%\usepackage[caption=false]{subfig}%provides \subfloat. use for composite figures %get subreferences with braces. Subreference means e.g. the "a)" in Figure "1.1 a)" where Figure 1.1 also has a panel "b)". Useful to refer to the subplots in the caption of the entire figure. \DeclareCaptionSubType[alph]{figure}%see https://tex.stackexchange.com/questions/125849/change-ref-format-for-subfigures \captionsetup[subfigure]{labelformat=simple,justification=centerlast}%strip original brace from subfigure two avoid having two after \renewcommand\thesubfigure{\alph{subfigure})}%braces after referencing subfigure \makeatletter \renewcommand\p@subfigure{\thefigure\,}%protected space(~) or protected half space (\,) between figure number and subfigure "number" \makeatother \usepackage[export]{adjustbox}%useful to trim images, similar to \includegraphics trim, but with acces to image-relative units such as "\width". Note that braces around relative trim units are required while braces around the set of all four trim units are optional, e.g. {{0.1\width} {0.2\height} 0 0}.% Also useful to vertically arrange (sub)figures with different heights. Example: %\begin{figure} % \centering % \subfloat[Bla 1.] % {% % \includegraphics[width=0.45\textwidth,valign=m]{subfigure1}% % \vphantom{\includegraphics[width=0.45\textwidth,valign=m]{subfigure2}}% % } % \hfill % \subfloat[Bla 2.] % {\includegraphics[width=0.45\textwidth,valign=m]{subfigure2}} % \caption{Bla.} %\end{figure}% %Tables (see also https://people.inf.ethz.ch/markusp/teaching/guides/guide-tables.pdf) \usepackage{longtable}%for tables which are longer than one page \usepackage{booktabs}%rules in tables \usepackage{multirow} %Example with repeating header (per page) in longtable %\begin{longtable}{p{2cm}p{11.8cm}} % \toprule % you need the package 'booktabs' for this % A & B\\ % \midrule % \endhead % 1 & 2\\ % 1 & 2\\ % 1 & 2\\ % 1 & 2\\ % \bottomrule %\end{longtable} %symbols \usepackage{amsmath} \usepackage{xparse}%required for the rowvector command defined in the convenience commands .tex file \usepackage{amssymb}%for e.g. \lesssim \usepackage{bm}%supplies the \bm command, recommended for bold math symbols. \boldsymbol{} from amsmath is considered obsolete \usepackage{siunitx}%handles recommended typesetting of values and units. I think there exist package options which could be used to keep value and unit formatting consistent throughout the document, i.e. either always "10" or "1e1" for values or "ms^{-1}" or "m/s" for units. I only used the package in its default configuration though. %\usepackage[version=4]{mhchem}%for chemistry typesetting, e.g. \ce{SO4^2-} or \ce{^{32}_{16}S+}. More examples can be found at https://www.namsu.de/Extra/pakete/Mhchem.html %package wants you to specify a version as the output for the same input may change in future versions %Ended up not using this package (overkill for me) and instead defined the macro ``\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}}'' in the Diss_ConvenienceCommands .tex file. \usepackage{physics}%provides symbols commonly used in physics-related work \newcommand*\diff{\mathop{}\!\mathrm{d}} % differential-d in math-mode with different typeface than the rest \usepackage{xspace}% correct(?) spacing after macros \usepackage{bbold} % used for unit matrix symbol \usepackage{mathrsfs} % more font options if you run out of symbols. I was especially short on "t"s for various waiting times, correlation times, relaxation times, pulse lenghts, temperature etc. \usepackage{stackrel} % additional options to \stackrel command, such as \stackrel[...]{}{} to place ... underneath something %add notes to work in progress \usepackage{todonotes}%can print a list of todonotes with \listoftodos. can disable todonotes by package option [disable]. %sketches. Not sure if I used these packages in the end. \usepackage{tikz} \usepackage{chemfig} \usepackage{calculator}%For simple calculations of e.g. automatically determine water fraction part of sample name when etoh fraction is known, see convenience commands .tex file. Package suggested here https://tex.stackexchange.com/questions/453454/calculations-on-variables-using-latex %documentation here: https://mirrors.ibiblio.org/CTAN/macros/latex/contrib/calculator/calculator.pdf \usepackage{xifthen}%check if either component is 100%, and if so, suppress label of absent component %documentation here: https://mirror.funkfreundelandshut.de/latex/macros/latex/contrib/xifthen/xifthen.pdf %internal links \usepackage{fnpct}%nicely distinguish multiple successive footnotes, i.e. to not confuse footnotes 1 and 2 with footnote 12 (https://tex.stackexchange.com/questions/28465/multiple-footnotes-at-one-point) %\numberwithin{equation}{chapter}%https://tex.stackexchange.com/questions/65926/hyperlinking-problems-when-using-subequations-hyperref-and-cleveref \usepackage{hyperref} \hypersetup{ colorlinks = true, %Colours links instead of ugly boxes. hidelinks option removes boxes but then does not highlight links at all % hidelinks, %un-comment to suppress link colors for the print version. Note that this does not have the "option=true/false" syntax. urlcolor = blue, %Colour for external hyperlinks linkcolor = blue,%\mylinkcolor, %Colour of internal links citecolor = red, %Colour of citations plainpages = false,%so that hyperref treats page ii and page 2 as separate pages, https://tex.stackexchange.com/questions/93889/why-does-backref-refer-to-wrong-page pdfpagelabels,%glossary pagenumbers get offset by 1 per \part, at least when I also mess with clearpage commands. trying solution of https://tex.stackexchange.com/questions/21698/how-to-get-correct-glossary-links-with-frontmatter-pages } %cleveref should be loaded after any package without specific support for cleveref. Safest to load it at the very end of the preamble \usepackage{cleveref}%myou ay want to use the [nameinlink] option to include/exclude reference types (equation, section etc.) in hyperlink. nameinlink appears to be too recent for the current (2024-12-17) installation on my office computer %customize abbreviations of e.g. section and chapter references. Do not repeat with \Crefname as abbreviations at the beginning of a sentence apparently count as bad style. \crefname{equation}{eq.}{eqs.}%crefname command: \crefname{type}{singular}{plural} \crefname{section}{sec.}{secs.} \crefname{chapter}{chap.}{chaps.} %to make a plural-reference to a set of subequations with a single label. Originally tried the solution from this link: https://tex.stackexchange.com/questions/35772/referencing-subequations-with-cleveref \crefformat{equation}{eq.~(#2#1#3)}% crefformat arguments: #1=formatted label counter, #2=start of hyperlink, #3=end of hyperlink \Crefformat{equation}{Eq.~(#2#1#3)}% \crefmultiformat{equation}{eqs.~(#2#1#3)}{ and~(#2#1#3)}{, (#2#1#3)}{ and~(#2#1#3)} \crefformat{section}{sec.~#2#1#3}%crefformat overwrites at least the singular from crefname \Crefformat{section}{Section~#2#1#3}%explicitly define \Crefformat, instead of using the default (\MakeUppercase together with \crefformat) because abbreviations at the beginning of a sentence are bad style. %\crefrangeformat{section}{secs.~(#3#1#4) and~(#5#2#6)} \crefmultiformat{section}{secs.~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} %Note that there is also \crefrangemultiformat, which I however did not need to specify \crefformat{chapter}{chap.~#2#1#3} \Crefformat{chapter}{Chapter~#2#1#3} \crefmultiformat{chapter}{chaps.~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} \crefformat{figure}{fig.~#2#1#3}%crefformat overwrites at least the singular from crefname \Crefformat{figure}{Figure~#2#1#3}%explicitly define \Crefformat, instead of using the default (\MakeUppercase together with \crefformat) because abbreviations at the beginning of a sentence are bad style. %\crefrangeformat{figure}{figs.~(#3#1#4) and~(#5#2#6)} \crefmultiformat{figure}{figs.~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3} %added specifically for the latex template \usepackage{listings}%used to display larger sections of code \lstset{% basicstyle=\ttfamily\small, commentstyle=\itshape\ttfamily\small, showspaces=false, showstringspaces=false, columns=flexible,%https://tex.stackexchange.com/questions/19949/how-to-make-listings-code-indentation-remain-unchanged-when-copied-from-pdf keepspaces=true,%https://tex.stackexchange.com/questions/19949/how-to-make-listings-code-indentation-remain-unchanged-when-copied-from-pdf breaklines=true, breakautoindent=true, frame=single captionpos=t language=TeX }