quarto-dev / quarto-dev/quarto-cli

global fig-align rule not respected by images without a caption

Aperta
#6,509 9 commenti 2 reazioni 1 assegnatario Vedi su GitHub

@cscheid ci sta già lavorando.

Dal 14/8/2023.

crossref enhancement figures latex
Lingua principale
JavaScript
Stelle
6k
Fork
458
Merge medio
1g 9h
PR unite (30g)
41

Descrizione

Bug description

If I define the global rule fig-align=center in the front matter, in the pdf produced by latex only images with captions are centered. Figures without caption are left-aligned.

The same thing happens if I set right alignment.

Steps to reproduce
---
title: "Test figure alignment"
format:
  pdf:
    fig-align: center
---

# Title

With caption

![With caption!](images/Placeholder.png)

Without caption

![](images/Placeholder.png)

Then
quarto render test.qmd --to-pdf

Expected behavior

All figures should be centered.

Actual behavior

Figures without caption are not centered.
Inspecting the latex source, I realized that the problem is the following.
Figures with caption are rendered this way

\begin{figure}
{\centering \includegraphics{images/Placeholder.png}
}
\caption{With caption!}
\end{figure}

But figures without caption are rendered this way:

\includegraphics{images/Placeholder.png}

Note that if a figure without caption is individually centered, ![](images/Placeholder.png){fig-align="center"}, all works well because the latex source is

\begin{figure}
{\centering \includegraphics{images/Placeholder.png}
}
\end{figure}
Your environment
  • IDE: VSCode 1.81.1
  • OS: Windows 10 Version 22H2 (build SO 19045.3324)
Quarto check output
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.3.450
      Path: C:\Users\rdima\scoop\apps\quarto\current\bin
      CodePage: 1252

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....(None)

      Unable to locate an installed version of Python 3.
      Install Python 3 from https://www.python.org/downloads/

[>] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.