Skip to content

Commit 782020a

Browse files
Chilleesimonlindholm
authored andcommitted
Added automatic shrinking of headers when needed (#121)
1 parent 208c9f6 commit 782020a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

content/tex/kactlpkg.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
\renewcommand{\headrulewidth}{0pt}
8181
\headheight 25pt
8282
\lhead{\@unishort}
83-
\chead{\hspace{3mm}\textbf{\immediate\write18{python2 content/tex/preprocessor.py --print-header "\splitbotmarks\hdrmark|\botmarks\hdrmark" -o \@builddir/header2.tmp}\immediate\input{\@builddir/header2.tmp}}}
83+
\chead{\immediate\write18{python2 content/tex/preprocessor.py --print-header "\splitbotmarks\hdrmark|\botmarks\hdrmark" -o \@builddir/header2.tmp}\immediate\input{\@builddir/header2.tmp}}
8484
\rhead{\thepage}
8585
%\lhead{}\chead{\thepage}\rhead{}
8686
\lfoot{}\cfoot{}\rfoot{}

content/tex/preprocessor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,15 @@ def print_header(data, outstream):
217217
return
218218

219219
ind = lines.index(until) + 1
220+
header_length = len("".join(lines[:ind]))
220221
def adjust(name):
221222
return name if name.startswith('.') else name.split('.')[0]
222223
output = r"\enspace{}".join(map(adjust, lines[:ind]))
224+
font_size = 10
225+
if header_length > 150:
226+
font_size = 8
227+
output = r"\hspace{3mm}\textbf{" + output + "}"
228+
output = "\\fontsize{%d}{%d}" % (font_size, font_size) + output
223229
print(output, file=outstream)
224230
with open('header.tmp', 'w') as f:
225231
for line in lines[ind:]:

kactl.pdf

86.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)