-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cite and bibitem even with citeproc #9031
Comments
For the motivation for this see #9022 (comment) |
citeproc styles specify parameters for the bibliography formatting, too (e.g. hanging indent width, entry spacing). Is there a way to customize these if we use bibitem? |
sure,
(you naturally need also a heading \section{Bibliography} but I assume that your code is adding it already). |
See #9031. TODO: - We're getting a double References heading; apparently the bibliography environment adds one. - We've lost the formatting of the references specified by the csl style (e.g. hanging indent).
Some working code in the issue9031 branch. |
What is the |
OK, I learned that |
In order to avoid the doubled References section heading, we need to replace
with
|
why don't you use your own list? You don't have to use thebibliography. |
Ah, so |
No thebibliography is not handled in a special way, it is simply tagged as a list. I doubt that this will change. |
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 use a special enumitem list for the bibliography items, instead of the old CSLReferences environment. Internal links to ids beginning in `ref-` are assumed to be links to bibliography items, and put inside a `\cite` instead of `\hyperref`. This may be a bit fragile, so we should probably add something to citeproc to more definitely identify citation links.
Improved code in issue9031 branch. This fixes the doubled title issue and supports CSL's settings for hanging indent and item spacing. \NewDocumentCommand\citeproctext{}{}
\NewDocumentCommand\citeproc{mm}{%
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
\makeatletter
% avoid brackets around text for \cite:
\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{\cslentryspacing}
\setlength{\cslentryspacing}{0em}
\usepackage{enumitem}
\newlist{biblist}{itemize}{1}
\setlist[biblist]{label={},leftmargin=\cslhangindent,itemindent=-1\cslhangindent,itemsep=\cslentryspacing}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} Citations look like (\citeproc{ref-baghramian:relativism}{Baghramian 2004}) and the bibliography: \section*{References}\label{references}
\addcontentsline{toc}{section}{References}
\phantomsection\label{refs}
\setlength{\cslentryspacing}{0em}
\begin{biblist}
\bibitem[\citeproctext]{ref-baghramian:relativism}
Baghramian, Maria. 2004. \emph{Relativism}. Oxford: Routledge.
\bibitem[\citeproctext]{ref-baghramian.coliva:relativism}
Baghramian, Maria, and Annalisa Coliva. 2020. \emph{Relativism}. Oxford:
Routledge.
\bibitem[\citeproctext]{ref-perry:thought}
Perry, John. 1986. {``Thought Without Representation.''}
\emph{Proceedings of the Aristotelian Society} 60: 137--66.
\end{biblist} |
Right now we |
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 use a special enumitem list for the bibliography items, instead of the old CSLReferences environment. Internal links to ids beginning in `ref-` are assumed to be links to bibliography items, and put inside a `\cite` instead of `\hyperref`. This may be a bit fragile, so we should probably add something to citeproc to more definitely identify citation links.
@u-fischer I haven't been able to get % Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{pagebackref}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math} % this also loads fontspec
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
% xetex/luatex font selection
\fi
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage{xcolor}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\NewDocumentCommand\citeproctext{}{}
\NewDocumentCommand\citeproc{mm}{%
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
\makeatletter
% avoid brackets around text for \cite:
\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{\cslentryspacing}
\setlength{\cslentryspacing}{0em}
\usepackage{enumitem}
\newlist{biblist}{itemize}{1}
\setlist[biblist]{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}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
pdftitle={Equal Validity and Disagreement},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\title{Equal Validity and Disagreement}
\author{John MacFarlane}
\date{January 15, 2022}
\begin{document}
\maketitle
\ldots
Like Baghramian's earlier book of the same title
(\citeproc{ref-baghramian:relativism}{Baghramian 2004}), it aims to be a
comprehensive critical survey, but unlike the earlier book it engages
extensively with the large literature on relativism that emerged in the
first two decades of this century. \ldots
\section*{References}\label{references}
\addcontentsline{toc}{section}{References}
\phantomsection\label{refs}
\setlength{\cslentryspacing}{0em}
\begin{biblist}
\bibitem[\citeproctext]{ref-baghramian:relativism}
Baghramian, Maria. 2004. \emph{Relativism}. Oxford: Routledge.
\end{biblist}
\end{document} |
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 use a special enumitem list for the bibliography items, instead of the old CSLReferences environment. Internal links to ids beginning in `ref-` are assumed to be links to bibliography items, and put inside a `\cite` instead of `\hyperref`. This may be a bit fragile, so we should probably add something to citeproc to more definitely identify citation links.
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`.
Here is a way of using the standard
\cite
and\bibitem
machinery for citations, while providing arbitrary text generated by citeproc. (Quoting an earlier comment by @u-fischer):Note: the empty lines between the bibitems are needed for backref.
Originally posted by @u-fischer in #9022 (comment)
The text was updated successfully, but these errors were encountered: