|
82 | 82 | \EndAccSupp{}% |
83 | 83 | } |
84 | 84 |
|
85 | | -\newcommand{\BeginCodeBlock}[1]{ |
86 | | - \vskip 3pt |
87 | | - \begingroup |
88 | | - |
89 | | - % The `\usepackage[none]{hyphenat}` invocation above disables hyphenation everywhere, |
90 | | - % and breaks word-wrapping on non-space characters within code blocks. This means that |
91 | | - % long symbol names without spaces will bleed off the edge of the page. Here we are |
92 | | - % re-enabling hyphenation behavior for code blocks to get non-space word-wrapping to |
93 | | - % function. |
94 | | - \hyphenpenalty=50 |
95 | | - \exhyphenpenalty=50 |
96 | | - |
97 | | - \textbf{\textit{\textcolor{codeblock-header}{\small \BeginDemarcated{Code}}}} |
98 | | - #1 |
99 | | -} |
100 | | - |
101 | | -\newcommand{\EndCodeBlock}{ |
102 | | - \textbf{\textit{\textcolor{codeblock-header}{\small \EndDemarcated{Code}}}} |
103 | | - \endgroup |
104 | | -} |
105 | | - |
106 | 85 | % Use upquote if available, for straight quotes in verbatim environments |
107 | 86 | \IfFileExists{upquote.sty}{\usepackage{upquote}}{} |
108 | 87 | \IfFileExists{microtype.sty}{% use microtype if available |
|
174 | 153 | % |
175 | 154 | $if(highlighting-macros)$ |
176 | 155 | $highlighting-macros$ |
| 156 | + |
| 157 | +% The following directives only apply to specs that use code blocks |
| 158 | +% and so are gated behind `if(highlighting-macros)`. In particular, |
| 159 | +% `\renewenvironment{Shaded}` fails to compile if the spec does not |
| 160 | +% include a code block, because in such cases Pandoc does not inject |
| 161 | +% the relevant definitions via `highlighting-macros`. |
| 162 | + |
| 163 | +% |
| 164 | +% code block style |
| 165 | +% |
| 166 | +\definecolor{codeblock-line}{RGB}{0,0,0} |
| 167 | +\definecolor{codeblock-background}{RGB}{255,255,255} |
| 168 | +\definecolor{codeblock-header}{RGB}{35,61,130} |
| 169 | + |
| 170 | +\usepackage{tcolorbox} |
| 171 | +\tcbuselibrary{breakable, skins} |
| 172 | +\tcbset{enhanced} |
| 173 | + |
| 174 | +% Draws a page-breakable black box around the code block. |
| 175 | +\renewenvironment{Shaded}{ |
| 176 | + \begin{tcolorbox}[ |
| 177 | + breakable, |
| 178 | + arc=0pt, |
| 179 | + boxrule=1pt, |
| 180 | + colback=codeblock-background, |
| 181 | + colframe=codeblock-line, |
| 182 | + ] |
| 183 | +}{ |
| 184 | + \end{tcolorbox} |
| 185 | +} |
| 186 | + |
| 187 | +% Allows text in the code block to break on spaces, periods, slashes, and colons. |
| 188 | +\usepackage{fvextra} |
| 189 | +\DefineVerbatimEnvironment{Highlighting}{Verbatim}{ |
| 190 | + commandchars=\\\{\}, |
| 191 | + breaklines, |
| 192 | + breaknonspaceingroup, |
| 193 | + breakafter=./: |
| 194 | +} |
| 195 | + |
| 196 | +\newcommand{\BeginCodeBlock}[1]{ |
| 197 | + \vskip 3pt |
| 198 | + \begingroup |
| 199 | + |
| 200 | + % The `\usepackage[none]{hyphenat}` invocation above disables hyphenation everywhere, |
| 201 | + % and breaks word-wrapping on non-space characters within code blocks. This means that |
| 202 | + % long symbol names without spaces will bleed off the edge of the page. Here we are |
| 203 | + % re-enabling hyphenation behavior for code blocks to get non-space word-wrapping to |
| 204 | + % function. |
| 205 | + \hyphenpenalty=50 |
| 206 | + \exhyphenpenalty=50 |
| 207 | + |
| 208 | + \textbf{\textit{\textcolor{codeblock-header}{\small \BeginDemarcated{Code}}}} |
| 209 | + #1 |
| 210 | +} |
| 211 | + |
| 212 | +\newcommand{\EndCodeBlock}{ |
| 213 | + \textbf{\textit{\textcolor{codeblock-header}{\small \EndDemarcated{Code}}}} |
| 214 | + \endgroup |
| 215 | +} |
| 216 | + |
177 | 217 | $endif$ |
178 | 218 |
|
179 | 219 | % https://github.com/Wandmalfarbe/pandoc-latex-template/issues/391 |
|
370 | 410 | \definecolor{table-section-background}{RGB}{224, 224, 224} |
371 | 411 | \definecolor{table-section-foreground}{RGB}{10, 10, 10} |
372 | 412 |
|
373 | | -% |
374 | | -% code block style |
375 | | -% |
376 | | -\definecolor{codeblock-line}{RGB}{0,0,0} |
377 | | -\definecolor{codeblock-background}{RGB}{255,255,255} |
378 | | -\definecolor{codeblock-header}{RGB}{35,61,130} |
379 | 413 | \usepackage{mdframed} |
380 | 414 | \newmdenv[ |
381 | 415 | linewidth=0pt, |
382 | 416 | backgroundcolor=informative-background, |
383 | 417 | skipabove=5pt, |
384 | 418 | nobreak=true]{informative} |
385 | 419 |
|
386 | | -\usepackage{tcolorbox} |
387 | | -\tcbuselibrary{breakable, skins} |
388 | | -\tcbset{enhanced} |
389 | | - |
390 | | -\renewenvironment{Shaded}{ |
391 | | - \begin{tcolorbox}[ |
392 | | - breakable, |
393 | | - arc=0pt, |
394 | | - boxrule=1pt, |
395 | | - colback=codeblock-background, |
396 | | - colframe=codeblock-line, |
397 | | - ] |
398 | | -}{ |
399 | | - \end{tcolorbox} |
400 | | -} |
401 | | - |
402 | | -\usepackage{fvextra} |
403 | | -\DefineVerbatimEnvironment{Highlighting}{Verbatim}{ |
404 | | - commandchars=\\\{\}, |
405 | | - breaklines, |
406 | | - breaknonspaceingroup, |
407 | | - breakafter=./: |
408 | | -} |
409 | | - |
410 | 420 | \newcommand{\hlineifmdframed}{} |
411 | 421 | \newcommand{\BeginInformative}[1]{ |
412 | 422 | % HACK: We need to add an extra hline to the ends of tables inside of notes, because |
|
0 commit comments