Skip to content

Commit 3d8d7de

Browse files
authored
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
1 parent 2c2d122 commit 3d8d7de

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ RUN tlmgr update --self && \
4141
titlesec \
4242
newunicodechar \
4343
tocloft \
44-
tools
44+
tools \
45+
changepage
4546

4647
RUN apk upgrade && apk add --no-cache \
4748
bash \

sample1.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ int main() {
125125
}
126126
```
127127

128+
\begin{tcgnote}
129+
some notes, bla bla bla bla bla bla, hello bla, hello bla. this is some words,
130+
watch out for this thing. you have to know about it. thanks for reading this note!
131+
\end{tcgnote}
132+
133+
\begin{tcgexample}
134+
do it this way
135+
\end{tcgexample}
136+
128137
## Another Couple Tables
129138

130139
Uncaptioned table:

template/eisvogel.latex

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,23 @@ $highlighting-macros$
185185
% pandoc includes fvextra in the default template.
186186
\usepackage{fvextra}
187187
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,fontsize=$if(code-block-font-size)$$code-block-font-size$$else$\small$endif$,commandchars=\\\{\}}
188+
$endif$
188189

189190
% Left-justify the document.
190191
\usepackage[document]{ragged2e}
191192
\RaggedRight{}
192193
\sloppy
193-
$endif$
194+
195+
% Define some special environments for TPM spec style NOTE and EXAMPLE
196+
\usepackage{changepage}
197+
\newenvironment{tcgnote}
198+
{\begin{adjustwidth}{6em}{}
199+
\makebox[0pt][r]{\makebox[6em][l]{NOTE:}}\ignorespaces}
200+
{\end{adjustwidth}}
201+
\newenvironment{tcgexample}
202+
{\begin{adjustwidth}{6em}{}
203+
\makebox[0pt][r]{\makebox[6em][l]{EXAMPLE:}}\ignorespaces}
204+
{\end{adjustwidth}}
194205

195206
% Customizations to the behavior of tables
196207
$if(tables)$
@@ -698,6 +709,14 @@ $endif$
698709
beforeskip=.5\baselineskip,
699710
afterskip=0em]{subparagraph}
700711

712+
% % Subsections don't wrap to a new page by default.
713+
% % Workaround from https://tex.stackexchange.com/questions/162236/subsection-on-new-page-if-it-doesnt-fit
714+
\preto{\section}{\clearpageafterfirst}
715+
\preto{\subsection}{\filbreak}
716+
\newcommand{\clearpageafterfirst}{%
717+
\gdef\clearpageafterfirst{\clearpage}%
718+
}
719+
701720
\newcommand{\coverbg}{/resources/img/greentop.png}
702721

703722
$if(template)$
@@ -708,6 +727,11 @@ $if(template)$
708727
{}
709728
$endif$
710729

730+
% Clean up the TOC a bit by ensuring that long section numbers don't overlap.
731+
% \usepackage[titles]{tocloft}
732+
% \renewcommand*{\cftsecnumwidth}{10em}
733+
% \renewcommand*{\cftsubsecnumwidth}{10em}
734+
% \renewcommand*{\cftsubsubsecnumwidth}{10em}
711735
\begin{document}
712736

713737
%%
@@ -743,7 +767,7 @@ $endif$
743767
{
744768
\begin{textblock*}{10.5cm}(7cm,11cm)
745769
\setstretch{2.8}
746-
\fontsize{36}{46}{\textsf{$title$}}\\
770+
\fontsize{36}{46}{\textbf{$title$}}\\
747771
\rule{7cm}{0.6mm}\\
748772
\vskip 0.5em
749773
\setstretch{1.0}

0 commit comments

Comments
 (0)