Skip to content

Commit 98ee55b

Browse files
committed
Allow to add raw LaTeX in sidebar via metadata
The `latex.before-metadata` value allows to add content before the metadata in the margin column. This is helpful as an escape hatch, e.g., when the sidebar needs to be modified to prevent it from overflowing the page. E.g.: latex: before-sidebar: '\vspace{-3cm}'
1 parent 9dbdcdb commit 98ee55b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

data/filters/parse-latex.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ function Pandoc (doc)
77
return nil -- do nothing
88
end
99

10-
return doc:walk {
10+
-- The `latex` metadata field is special, raw LaTeX is always allowed in
11+
-- there.
12+
local latex = doc.meta.latex
13+
14+
doc = doc:walk {
1115
RawBlock = function (raw)
1216
if raw.format:match 'tex' then
1317
return pandoc.read(
@@ -29,4 +33,8 @@ function Pandoc (doc)
2933
end
3034
end
3135
}
36+
37+
-- Restore the `latex` metadata field.
38+
doc.meta.latex = latex
39+
return doc
3240
end

data/templates/default.latex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ $endif$
472472
\marginpar{
473473

474474
\begin{flushleft}
475+
$if(latex.before-metadata)$
476+
${latex.before-metadata}
477+
$endif$
475478
%\hrule
476479
\sffamily\small
477480

0 commit comments

Comments
 (0)