Rewrite CSLReferences environment...

...to avoid depending on enumitem, which plays badly with
beamer.  Instead we use a regular list environment.
Thanks to @jpcirrus for the concept.

We also restore the pre-3.1.7 format of the CSLReferences
environment, which again has two parameters. The first
determines whether a hanging indent is used (1 = yes, 0 = no),
and the second is the entry line spacing (0 = none).

Closes #9053.
This commit is contained in:
John MacFarlane
2023-09-05 20:24:20 -07:00
parent 4b1fc4de72
commit b7e1ce422c
2 changed files with 21 additions and 16 deletions
+13 -9
View File
@@ -350,15 +350,19 @@ $if(csl-refs)$
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslentryspacing}
\setlength{\cslentryspacing}{0em}
\usepackage{enumitem}
\newlist{CSLReferences}{itemize}{1}
\setlist[CSLReferences]{label={},
leftmargin=\cslhangindent,
itemindent=-1\cslhangindent,
parsep=\parskip,
itemsep=\cslentryspacing}
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
{\begin{list}{}{%
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{0pt}
\setlength{\parsep}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\setlength{\leftmargin}{\cslhangindent}
\setlength{\itemindent}{-1\cslhangindent}
\fi
% set entry spacing
\setlength{\itemsep}{#2\baselineskip}}}
{\end{list}}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{\hfill\break#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
+8 -7
View File
@@ -339,14 +339,15 @@ blockToLaTeX (Div (identifier,classes,kvs) bs) = do
then do
modify $ \st -> st{ stHasCslRefs = True }
inner <- blockListToLaTeX bs
return $ (if "hanging-indent" `notElem` classes
then "\\setlength{\\cslhangindent}{0em}"
else mempty)
$$ ("\\setlength{\\cslentryspacing}" <> braces
return $ ("\\begin{CSLReferences}"
<> braces
(if "hanging-indent" `elem` classes
then "1"
else "0")
<> braces
(case lookup "entry-spacing" kvs of
Nothing -> "0em"
Just s -> (literal s <> "\\baselineskip")))
$$ "\\begin{CSLReferences}"
Nothing -> "0"
Just s -> literal s))
$$ inner
$+$ "\\end{CSLReferences}"
else blockListToLaTeX bs