From 3d8d7def07c41906bb9d209a805c698ae7308f58 Mon Sep 17 00:00:00 2001 From: Chris Fenner Date: Sat, 9 Dec 2023 15:41:31 -0800 Subject: [PATCH] fix subsections wrapping to next page (#45) * fix subsections wrapping to next page * experimental: disable RedeclareSections * remove workaround * delete redeclares * try getting rid of runin * increase toc spacing, try moving toc workaround * disable all section spacing modifications * try setlength * add tcgnote and tcgexample environments * move setlengths * add changepage package * remove cftchapnumwidth * re-enable runin * modify toc section numbers * try renewcommand * comment out toc cleanups for now --- Dockerfile | 3 ++- sample1.md | 9 +++++++++ template/eisvogel.latex | 28 ++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 02886dc..195e615 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,8 @@ RUN tlmgr update --self && \ titlesec \ newunicodechar \ tocloft \ - tools + tools \ + changepage RUN apk upgrade && apk add --no-cache \ bash \ diff --git a/sample1.md b/sample1.md index bab5551..2fc4620 100644 --- a/sample1.md +++ b/sample1.md @@ -125,6 +125,15 @@ int main() { } ``` +\begin{tcgnote} +some notes, bla bla bla bla bla bla, hello bla, hello bla. this is some words, +watch out for this thing. you have to know about it. thanks for reading this note! +\end{tcgnote} + +\begin{tcgexample} +do it this way +\end{tcgexample} + ## Another Couple Tables Uncaptioned table: diff --git a/template/eisvogel.latex b/template/eisvogel.latex index 0103b3a..2cb23d3 100644 --- a/template/eisvogel.latex +++ b/template/eisvogel.latex @@ -185,12 +185,23 @@ $highlighting-macros$ % pandoc includes fvextra in the default template. \usepackage{fvextra} \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,fontsize=$if(code-block-font-size)$$code-block-font-size$$else$\small$endif$,commandchars=\\\{\}} +$endif$ % Left-justify the document. \usepackage[document]{ragged2e} \RaggedRight{} \sloppy -$endif$ + +% Define some special environments for TPM spec style NOTE and EXAMPLE +\usepackage{changepage} +\newenvironment{tcgnote} +{\begin{adjustwidth}{6em}{} + \makebox[0pt][r]{\makebox[6em][l]{NOTE:}}\ignorespaces} +{\end{adjustwidth}} +\newenvironment{tcgexample} +{\begin{adjustwidth}{6em}{} + \makebox[0pt][r]{\makebox[6em][l]{EXAMPLE:}}\ignorespaces} +{\end{adjustwidth}} % Customizations to the behavior of tables $if(tables)$ @@ -698,6 +709,14 @@ $endif$ beforeskip=.5\baselineskip, afterskip=0em]{subparagraph} +% % Subsections don't wrap to a new page by default. +% % Workaround from https://tex.stackexchange.com/questions/162236/subsection-on-new-page-if-it-doesnt-fit +\preto{\section}{\clearpageafterfirst} +\preto{\subsection}{\filbreak} +\newcommand{\clearpageafterfirst}{% + \gdef\clearpageafterfirst{\clearpage}% +} + \newcommand{\coverbg}{/resources/img/greentop.png} $if(template)$ @@ -708,6 +727,11 @@ $if(template)$ {} $endif$ +% Clean up the TOC a bit by ensuring that long section numbers don't overlap. +% \usepackage[titles]{tocloft} +% \renewcommand*{\cftsecnumwidth}{10em} +% \renewcommand*{\cftsubsecnumwidth}{10em} +% \renewcommand*{\cftsubsubsecnumwidth}{10em} \begin{document} %% @@ -743,7 +767,7 @@ $endif$ { \begin{textblock*}{10.5cm}(7cm,11cm) \setstretch{2.8} - \fontsize{36}{46}{\textsf{$title$}}\\ + \fontsize{36}{46}{\textbf{$title$}}\\ \rule{7cm}{0.6mm}\\ \vskip 0.5em \setstretch{1.0}