public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* citeproc LaTeX output: widowed "Reference" heading
@ 2021-10-13 10:20 Julien Dutant
       [not found] ` <d4d25c1d-2962-4286-98f7-2a4384573713n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Dutant @ 2021-10-13 10:20 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2970 bytes --]

Hi all,

LaTeX normally avoids lone section headings at the bottom of a page. But 
with citeproc's output the "References" heading can end up widowed. Here's 
a MWE (compile with `-s -C -o test.pdf` and adjust the vskip if you don't 
see the effect): 

```markdown
---
references:
- type: article-journal
  id: WatsonCrick1953
  author:
    - family: Watson
      given: J. D.
    - family: Crick
      given: F. H. C.
  issued:
    date-parts: 
    - [1953, 4, 25]
  title: 'Molecular structure of nucleic acids: a structure for 
    deoxyribose nucleic acid'
  title-short: Molecular structure of nucleic acids 
  container-title: Nature
  volume: 171
  issue: 4356
  page: 737-738
  DOI: 10.1038/171737a0
---

[@WatsonCrick1953] \vskip 38pc 

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, 
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum 
gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate 
a, magna.

# References
```

Citeproc's LaTeX code for this is:

```latex
\hypertarget{references}{%
\section*{References}\label{references}}
\addcontentsline{toc}{section}{References}

\hypertarget{refs}{}
\begin{CSLReferences}{1}{0}
\leavevmode\vadjust pre{\hypertarget{ref-WatsonCrick1953}{}}%
Watson, J. D., and F. H. C. Crick. 1953. {``Molecular Structure of
...
\end{CSLReferences}
```

As far as I can tell what generates the bug is `\vadjust pre{}`. If you 
remove `pre` the first line of the bibliography remains attached to the 
heading.

`\vadjust` is pretty deep TeX voodoo so I don't undertsand well what it's 
doing and why it's needed here. This is what the pdfTeX manual says about 
its "pre" specifier:

"The \vadjust implementation of pdfTEX adds an optional qualifier ⟨pre 
spec⟩ , which is simply the string pre, to the original TEX primitive with 
the same name. If no pre is given, \vadjust behaves exactly as the original 
(see The TEXbook, p. 281): it appends an adjustment item created from 
⟨vertical mode material⟩ to the current list after the line in which 
\vadjust appears. However, with the qualifier pre, the adjustment item is 
put before the line in which \vadjust pre appears."

Is the "pre" added to make sure that the href target is placed right before 
the reference, rather than after its first line? Would it be ok to remove 
it, or remove it for the first entry of a bibliography? Is there an 
alternative to it? (Whatever natbib or biblatex do?)

Best,

J


-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/d4d25c1d-2962-4286-98f7-2a4384573713n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 4157 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: citeproc LaTeX output: widowed "Reference" heading
       [not found] ` <d4d25c1d-2962-4286-98f7-2a4384573713n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-10-14 16:41   ` Julien Dutant
  0 siblings, 0 replies; 2+ messages in thread
From: Julien Dutant @ 2021-10-14 16:41 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3799 bytes --]

PS, relevant background is given is in #7078:
https://github.com/jgm/pandoc/issues/7078
`\leavevmode` is needed for beamer. `\vadjust pre{...}` is used to place 
the hyperref target correctly. But `\vadjust pre` also seems to place an 
invisible line before the first biblio item, which allows the References 
title to be widowed. It'd be good to find a LaTeX output that handles 
beamer + ordinary latex, places the hyperref targets well *but* doesn't let 
the References be widowed. I've quickly looked at the natbib and biblatex 
outputs but didn't find a straightforward solution. 

J

On Wednesday, October 13, 2021 at 11:20:49 AM UTC+1 Julien Dutant wrote:

> Hi all,
>
> LaTeX normally avoids lone section headings at the bottom of a page. But 
> with citeproc's output the "References" heading can end up widowed. Here's 
> a MWE (compile with `-s -C -o test.pdf` and adjust the vskip if you don't 
> see the effect): 
>
> ```markdown
> ---
> references:
> - type: article-journal
>   id: WatsonCrick1953
>   author:
>     - family: Watson
>       given: J. D.
>     - family: Crick
>       given: F. H. C.
>   issued:
>     date-parts: 
>     - [1953, 4, 25]
>   title: 'Molecular structure of nucleic acids: a structure for 
>     deoxyribose nucleic acid'
>   title-short: Molecular structure of nucleic acids 
>   container-title: Nature
>   volume: 171
>   issue: 4356
>   page: 737-738
>   DOI: 10.1038/171737a0
> ---
>
> [@WatsonCrick1953] \vskip 38pc 
>
> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, 
> vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum 
> gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate 
> a, magna.
>
> # References
> ```
>
> Citeproc's LaTeX code for this is:
>
> ```latex
> \hypertarget{references}{%
> \section*{References}\label{references}}
> \addcontentsline{toc}{section}{References}
>
> \hypertarget{refs}{}
> \begin{CSLReferences}{1}{0}
> \leavevmode\vadjust pre{\hypertarget{ref-WatsonCrick1953}{}}%
> Watson, J. D., and F. H. C. Crick. 1953. {``Molecular Structure of
> ...
> \end{CSLReferences}
> ```
>
> As far as I can tell what generates the bug is `\vadjust pre{}`. If you 
> remove `pre` the first line of the bibliography remains attached to the 
> heading.
>
> `\vadjust` is pretty deep TeX voodoo so I don't undertsand well what it's 
> doing and why it's needed here. This is what the pdfTeX manual says about 
> its "pre" specifier:
>
> "The \vadjust implementation of pdfTEX adds an optional qualifier ⟨pre 
> spec⟩ , which is simply the string pre, to the original TEX primitive with 
> the same name. If no pre is given, \vadjust behaves exactly as the original 
> (see The TEXbook, p. 281): it appends an adjustment item created from 
> ⟨vertical mode material⟩ to the current list after the line in which 
> \vadjust appears. However, with the qualifier pre, the adjustment item is 
> put before the line in which \vadjust pre appears."
>
> Is the "pre" added to make sure that the href target is placed right 
> before the reference, rather than after its first line? Would it be ok to 
> remove it, or remove it for the first entry of a bibliography? Is there an 
> alternative to it? (Whatever natbib or biblatex do?)
>
> Best,
>
> J
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/35bf2c35-8b95-4f53-b9ae-8c3095d45083n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 5025 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-14 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 10:20 citeproc LaTeX output: widowed "Reference" heading Julien Dutant
     [not found] ` <d4d25c1d-2962-4286-98f7-2a4384573713n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-10-14 16:41   ` Julien Dutant

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 NNTP newsgroup(s).