inc_header_pdf.tex 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. %% For pandoc --include-in-header
  2. %%
  3. %% Start sections on new pages
  4. \usepackage{sectsty}
  5. \sectionfont{\clearpage}
  6. %% Place figures "here" (i.e. immediately, don't move them around)
  7. \usepackage{graphicx}
  8. \usepackage{float}
  9. \floatplacement{figure}{H}
  10. %% For glossary definition list
  11. %% https://github.com/jgm/pandoc/wiki/Pandoc-Tricks#definition-list-terms-on-their-own-line-in-latex
  12. \let\originalitem\item
  13. \makeatletter
  14. \renewcommand{\item}[1][\@nil]{%
  15. \def\tmp{#1}
  16. \ifx\tmp\@nnil\originalitem\else\originalitem[#1]\hfill\par\fi}
  17. \makeatother
  18. %% Text and background color for inline code
  19. \usepackage{xcolor}
  20. \definecolor{icfg}{HTML}{331a33}
  21. \let\oldtexttt\texttt
  22. \renewcommand{\texttt}[1]{\textcolor{icfg}{\oldtexttt{#1}}}
  23. %% Unfortunately this messes up wrapping TODO: fix
  24. %% Background color for inline code https://tex.stackexchange.com/a/507116
  25. %\definecolor{icbg}{HTML}{fafafa} % Same as modified pygments.theme
  26. %\newcommand{\code}[1]{%
  27. %\begingroup\setlength{\fboxsep}{1pt}
  28. %\colorbox{icbg}{\oldtexttt{\hspace*{0.1pt}\vphantom{A}#1\hspace*{0.1pt}}}\endgroup}
  29. %\renewcommand{\texttt}[1]{\textcolor{icfg}{\code{\oldtexttt{#1}}}}
  30. %% Make level-4 headings standalone (not run-in) - for some reason "-V block-headings" doesn't seem to work, so do
  31. %% what it does manually here
  32. \let\oldparagraph\paragraph
  33. \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
  34. %% https://github.com/tomduck/pandoc-tablenos
  35. %% As using --include-in-header (this file), need to manually include the following (displayed by setting
  36. %% "-M tablenos-warning-level=2"):
  37. %% PDF metadata - the values are set in "docs/inc_before_body.tex" (otherwise may get overridden)
  38. \usepackage{hyperref}
  39. %% pandoc-tablenos: required package
  40. \usepackage{caption}
  41. %% pandoc-tablenos: environment to disable table caption prefixes
  42. \makeatletter
  43. \newcounter{tableno}
  44. \newenvironment{tablenos:no-prefix-table-caption}{
  45. \caption@ifcompatibility{}{
  46. \let\oldthetable\thetable
  47. \let\oldtheHtable\theHtable
  48. \renewcommand{\thetable}{tableno:\thetableno}
  49. \renewcommand{\theHtable}{tableno:\thetableno}
  50. \stepcounter{tableno}
  51. \captionsetup{labelformat=empty}
  52. }
  53. }{
  54. \caption@ifcompatibility{}{
  55. \captionsetup{labelformat=default}
  56. \let\thetable\oldthetable
  57. \let\theHtable\oldtheHtable
  58. \addtocounter{table}{-1}
  59. }
  60. }
  61. \makeatother
  62. %% pandoc-tablenos: environment for tagged tables
  63. \newenvironment{tablenos:tagged-table}[1][]{
  64. \let\oldthetable\thetable
  65. \let\oldtheHtable\theHtable
  66. \renewcommand{\thetable}{#1}
  67. \renewcommand{\theHtable}{#1}
  68. }{
  69. \let\thetable\oldthetable
  70. \let\theHtable\oldtheHtable
  71. \addtocounter{table}{-1}
  72. }