emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] oc-csl: Improve LaTeX bibliography formatting


From: Ihor Radchenko
Subject: Re: [PATCH] oc-csl: Improve LaTeX bibliography formatting
Date: Mon, 07 Nov 2022 02:47:51 +0000

András Simonyi <andras.simonyi@gmail.com> writes:

> the attached patch substantially improves the formatting of CSL-based
> bibliographies in LaTeX export by supporting in-style formatting
> settings that were previously ignored, most importantly,
> 'second-field-align', which is typically used for numeric styles such
> as ieee.csl.
>
> I'm sending this while another oc-csl patch (about affix and locator
> formatting) is still under discussion because I consider it a priority
> for the 9.6 release. (Not supporting those formatting settings
> rendered a large number of styles, some of them pretty popular, close
> to being unusable.)

Thanks for the patch!

Please, document the new customization in ORG-NEWS.
Also, it would be nice to describe CSL usage and tweaks in the manual.

> +;; The following was inspired by and mostly follows how Pandoc's
> +;; (<https://github.com/jgm/pandoc>) default LaTeX template handles
> +;; CSL output.  Many thanks to the author, John MacFarlane!
> +(defcustom org-cite-csl-latex-preamble
> +  "\\usepackage{calc}
> +\\newlength{\\cslhangindent}
> +\\setlength{\\cslhangindent}{[CSL-HANGINDENT]}
> +\\newlength{\\csllabelsep}
> +\\setlength{\\csllabelsep}{[CSL-LABELSEP]}
> +\\newlength{\\csllabelwidth}
> +\\setlength{\\csllabelwidth}{[CSL-LABELWIDTH-PER-CHAR] * 
> [CSL-MAXLABEL-CHARS]}
> +\\newenvironment{citeprocbib}[2] % 1st arg. is hanging-indent, 2nd entry 
> spacing.
> + {% By default, paragraphs are not indented.
> +  \\setlength{\\parindent}{0pt}
> +  % Hanging indent is turned on when first argument is 1.
> +  \\ifodd #1
> +  \\let\\oldpar\\par
> +  \\def\\par{\\hangindent=\\cslhangindent\\oldpar}
> +  \\fi
> +  % Set entry spacing based on the second argument.
> +  \\setlength{\\parskip}{\\parskip +  #2\\baselineskip}
> + }%
> + {}
> +\\newcommand{\\cslblock}[1]{#1\\hfill\\break}
> +\\newcommand{\\cslleftmargin}[1]{\\parbox[t]{\\csllabelsep + 
> \\csllabelwidth}{#1}}
> +\\newcommand{\\cslrightinline}[1]
> +  {\\parbox[t]{\\linewidth - \\csllabelsep - \\csllabelwidth}{#1}\\break}
> +\\newcommand{\\cslindent}[1]{\\hspace{\\cslhangindent}#1}
> +\\makeatletter
> +\\newcommand{\\citeprocitem}[2]
> + {\\protect\\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\\hyper@linkend}
> +\\makeatother"
> +  "LaTeX preamble content inserted by the `csl' citation processor.
> +
> +The placeholders [CSL-HANGINDENT], [CSL-LABELSEP],
> +[CSL-LABELWIDTH-PER-CHAR] and [CSL-MAXLABEL-CHARS] are replaced,
> +respectively, by the contents of the customizable variables
> +`org-cite-csl-latex-hanging-indent', `org-cite-csl-latex-label-separator',
> +`org-cite-csl-latex-label-width-per-char', and the maximal label length
> +in the bibliography measured in characters."
> +  :group 'org-cite
> +  :type 'string
> +  :package-version '(Org . "9.6"))
> +

I have two comments here:
1. Where are all these new commands coming from? They are not used
   directly in the code. Are you tweaking citeproc.el output this way? May
   it be better to use customizations provided by citeproc.el itself?
2. You are declaring this variable as defcustom, but it is not clear
   what is going to happen if the user changes it. It is not how to
   change this template in meaningful ways either.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]