Skip to content

Commit

Permalink
fix subsections wrapping to next page (#45)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
chrisfenner authored Dec 9, 2023
1 parent 2c2d122 commit 3d8d7de
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ RUN tlmgr update --self && \
titlesec \
newunicodechar \
tocloft \
tools
tools \
changepage

RUN apk upgrade && apk add --no-cache \
bash \
Expand Down
9 changes: 9 additions & 0 deletions sample1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
28 changes: 26 additions & 2 deletions template/eisvogel.latex
Original file line number Diff line number Diff line change
Expand Up @@ -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)$
Expand Down Expand Up @@ -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)$
Expand All @@ -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}

%%
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 3d8d7de

Please sign in to comment.