emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "András Simonyi" <andras.simonyi@gmail.com>
Cc: emacs-orgmode list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] oc-csl: Improve LaTeX bibliography formatting
Date: Mon, 07 Nov 2022 02:47:51 +0000	[thread overview]
Message-ID: <87o7tja3ag.fsf@localhost> (raw)
In-Reply-To: <CAOWRwxDs85nj=Si-ERyYK35OpePtsLPevNKWWJdU5-i42oLetQ@mail.gmail.com>

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	other threads:[~2022-11-07  2:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06  9:42 [PATCH] oc-csl: Improve LaTeX bibliography formatting András Simonyi
2022-11-07  2:47 ` Ihor Radchenko [this message]
2022-11-07 11:15   ` András Simonyi
2022-11-08  5:26     ` Ihor Radchenko
2022-12-11 19:00       ` András Simonyi
2022-12-12  9:07         ` Ihor Radchenko
2022-12-12 11:15           ` András Simonyi
2022-12-12 11:24             ` Ihor Radchenko
2022-12-29 15:40               ` Bastien Guerry
2022-12-31 12:22                 ` Screenshots in ORG-NEWS (was: [PATCH] oc-csl: Improve LaTeX bibliography formatting) Ihor Radchenko
2023-01-02 15:11                   ` Screenshots in ORG-NEWS Bastien
2023-01-03 10:34                     ` Ihor Radchenko
2023-01-03 12:36                       ` Bastien
2022-12-13 16:05           ` [PATCH] oc-csl: Improve LaTeX bibliography formatting Timothy
2022-12-13 19:03             ` András Simonyi
2022-12-27 22:32               ` András Simonyi
2022-12-29 10:14                 ` Ihor Radchenko
2022-12-29 21:51                   ` András Simonyi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7tja3ag.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=andras.simonyi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).