Skip to content

Commit 3e0e49f

Browse files
authored
Merge pull request #200 from Zettlr/wideaperture-patch-2
Update custom-templates.md
2 parents 01f6b81 + 0cf2ac7 commit 3e0e49f

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/en/advanced/custom-templates.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,48 @@ $body$
5050

5151
Pandoc will replace this variable with the parsed contents of your Markdown file(s). If you leave it out, your content will not appear in the output file.
5252

53+
## Citations and References
54+
55+
If you're using Zettlr's reference manager-integration to insert dynamic references from Zotero or another app into your article, you'll need to add the following code block to the preamble of your LaTeX template:
56+
57+
```latex
58+
$if(csl-refs)$
59+
% definitions for citeproc citations
60+
\NewDocumentCommand\citeproctext{}{}
61+
\NewDocumentCommand\citeproc{mm}{%
62+
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
63+
\makeatletter
64+
% allow citations to break across lines
65+
\let\@cite@ofmt\@firstofone
66+
% avoid brackets around text for \cite:
67+
\def\@biblabel#1{}
68+
\def\@cite#1#2{{#1\if@tempswa , #2\fi}}
69+
\makeatother
70+
\newlength{\cslhangindent}
71+
\setlength{\cslhangindent}{1.5em}
72+
\newlength{\csllabelwidth}
73+
\setlength{\csllabelwidth}{3em}
74+
\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing
75+
{\begin{list}{}{%
76+
\setlength{\itemindent}{0pt}
77+
\setlength{\leftmargin}{0pt}
78+
\setlength{\parsep}{0pt}
79+
% turn on hanging indent if param 1 is 1
80+
\ifodd #1
81+
\setlength{\leftmargin}{\cslhangindent}
82+
\setlength{\itemindent}{-1\cslhangindent}
83+
\fi
84+
% set entry spacing
85+
\setlength{\itemsep}{#2\baselineskip}}}
86+
{\end{list}}
87+
\usepackage{calc}
88+
\newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}}
89+
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}}
90+
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}}
91+
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
92+
$endif$
93+
```
94+
5395
## Activate your template
5496

5597
In order to put your template to work, you must point Zettlr to it, via the PDF Defaults File in the Assets Manager. Navigate to the Assets Manager from Zettlr's Menu and select 'PDF' from the list of configurations ('Defaults Files') on the left. Next add `template: ` to the bottom of the configuration file. Note the space after the colon. Now Zettlr needs to know the path to your new template file. Locate your template file, which if you've created it in Zettlr, you may find by right-clicking on the file in Zettlr's file manager and select 'Show File'. Note that the name of the LaTeX file must end in `.tex`. Once you've found the file, you need to find it's location in your computer's directory structure – which is the file's 'path' or 'pathname'.

0 commit comments

Comments
 (0)