mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-19 02:22:09 +08:00
Use \cite and \bibitem to link up citations, even with citeproc.
See #9031 and discussion in #9020. This will give us better accessibility; when tagging is enabled, the citation can be linked to the bibliography entry. This changes some of the details of the layout and the default template. We now make CSLReferences a special enumitem list that will contain `\bibitem`s. Internal links inside citations to ids beginning in `ref-` are put inside a `\cite` instead of `\hyperref`. Closes #9031.
This commit is contained in:
@@ -335,24 +335,28 @@ $if(pagestyle)$
|
||||
\pagestyle{$pagestyle$}
|
||||
$endif$
|
||||
$if(csl-refs)$
|
||||
% definitions for citeproc citations
|
||||
\NewDocumentCommand\citeproctext{}{}
|
||||
\NewDocumentCommand\citeproc{mm}{%
|
||||
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
|
||||
% avoid brackets around text for \cite:
|
||||
\makeatletter
|
||||
\def\@biblabel#1{}
|
||||
\def\@cite#1#2{{#1\if@tempswa , #2\fi}}
|
||||
\makeatother
|
||||
\newlength{\cslhangindent}
|
||||
\setlength{\cslhangindent}{1.5em}
|
||||
\newlength{\csllabelwidth}
|
||||
\setlength{\csllabelwidth}{3em}
|
||||
\newlength{\cslentryspacingunit} % times entry-spacing
|
||||
\setlength{\cslentryspacingunit}{\parskip}
|
||||
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
|
||||
{% don't indent paragraphs
|
||||
\setlength{\parindent}{0pt}
|
||||
% turn on hanging indent if param 1 is 1
|
||||
\ifodd #1
|
||||
\let\oldpar\par
|
||||
\def\par{\hangindent=\cslhangindent\oldpar}
|
||||
\fi
|
||||
% set entry spacing
|
||||
\setlength{\parskip}{#2\cslentryspacingunit}
|
||||
}%
|
||||
{}
|
||||
\newlength{\cslentryspacing}
|
||||
\setlength{\cslentryspacing}{0em}
|
||||
\usepackage{enumitem}
|
||||
\newlist{CSLReferences}{itemize}{1}
|
||||
\setlist[CSLReferences]{label={},
|
||||
leftmargin=\cslhangindent,
|
||||
itemindent=-1\cslhangindent,
|
||||
parsep=\parskip,
|
||||
itemsep=\cslentryspacing}
|
||||
\usepackage{calc}
|
||||
\newcommand{\CSLBlock}[1]{#1\hfill\break}
|
||||
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
|
||||
|
||||
Reference in New Issue
Block a user