Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spacing in List of Figures / List of Tables #5788

Closed
jkylearmstrong opened this issue Jun 2, 2023 · 5 comments
Closed

Spacing in List of Figures / List of Tables #5788

jkylearmstrong opened this issue Jun 2, 2023 · 5 comments
Labels
bug Something isn't working
Milestone

Comments

@jkylearmstrong
Copy link

jkylearmstrong commented Jun 2, 2023

Bug description

I think there may be an error with how the spacing is done in the listing of tables and figures. For example, when I get to chapter 10 figure 10 the text reads as

10.10Mosaic Confusion Matrix of Base Model . . . . . . . . . . . . . 430

here is a screen shot of the rendered pdf

image

after creating the repo example I decided to go further to look at the behavior at 100 figures and here the figure numbers completely overwrite the text:
image

Steps to reproduce

I made a repo that has an example:
https://github.com/jkylearmstrong/quarto_figure_space_issue

Expected behavior

hopefully add an additional space in between the figure number and the figure name.

Actual behavior

image

image

Your environment

paste("RStudio version", RStudio.Version()$long_version)
paste("quarto version", paste(quarto::quarto_version(), sep='.'))
[1] "RStudio version 2023.03.0+386"
[1] "quarto version 1.4.11"
tibble::enframe(Sys.info()) %>%
     filter(name %in% c('sysname','release','version','machine')) %>%
     head(10)
# A tibble: 4 × 2
  name    value      
  <chr>   <chr>      
1 sysname Windows    
2 release 10 x64     
3 version build 22621
4 machine x86-64  
tibble::as_tibble(R.Version()) %>%    
    tidyr::pivot_longer(everything()) %>% 
    head(20)
# A tibble: 15 × 2
   name           value                              
   <chr>          <chr>                              
 1 platform       "x86_64-w64-mingw32"               
 2 arch           "x86_64"                           
 3 os             "mingw32"                          
 4 crt            "ucrt"                             
 5 system         "x86_64, mingw32"                  
 6 status         ""                                 
 7 major          "4"                                
 8 minor          "3.0"                              
 9 year           "2023"                             
10 month          "04"                               
11 day            "21"                               
12 svn rev        "84292"                            
13 language       "R"                                
14 version.string "R version 4.3.0 (2023-04-21 ucrt)"
15 nickname       "Already Tomorrow"

Quarto check output

quarto check
A new release of Deno is available: 1.28.2 → 1.33.4 Run `deno upgrade` to install it.

[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.2: OK
      Dart Sass version 1.55.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.4.11
      Path: C:\Program Files\Quarto\bin
      CodePage: 1252

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

[>] Checking Python 3 installation....OK
      Version: 3.10.9 (Conda)
      Path: C:/ProgramData/anaconda3/python.exe
      Jupyter: 5.2.0
      Kernels: python3

[>] Checking Jupyter engine render....OK

[>] Checking R installation...........OK
      Version: 4.3.0
      Path: C:/PROGRA~1/R/R-43~1.0
      LibPaths:
        - C:/Users/jkyle/AppData/Local/R/win-library/4.3
        - C:/Program Files/R/R-4.3.0/library
      knitr: 1.43
      rmarkdown: 2.22

[>] Checking Knitr engine render......OK

I don't know if deno is the issue, I have tried to update it however, when I run

deno upgrade

from RStudio terminal I get

'deno' is not recognized as an internal or external command,
operable program or batch file.
@jkylearmstrong jkylearmstrong added the bug Something isn't working label Jun 2, 2023
@cderv
Copy link
Collaborator

cderv commented Jun 2, 2023

I don't know if deno is the issue, I have tried to update it however, when I run

Deno is not the issue, and you should not have to manage it. This message should not be shown really, but it seems I was right to create #4394 to track this. It seems we still don't correct manage to hide the deno upgrade messge on Windows 🤔

I think there may be an error with how the spacing is done in the listing of tables and figures.

I believe this is a LaTeX issue, or configuration regarding default behavior. I have found mention of it in old issue: https://tex.stackexchange.com/questions/187180/spacing-problem-at-list-of-figures

As we use Koma script by default for PDF, maybe there is some configuration that can be added :https://tex.stackexchange.com/questions/381398/using-numwidth-in-koma-class-for-list-of-figures-and-list-of-tables 🤔

Anyhow, it seems to be some LaTeX config that can probably be done with including preamble by user, or change the default style in our template (ou in upstream Pandoc)

@jkylearmstrong
Copy link
Author

jkylearmstrong commented Jun 2, 2023

Ah, my old pal LaTeX.

Thank you so much @cderv !

I updated the _quarto.yml YAML file as suggested in the link you provided, and now it works great! Many thanks!

_quarto.yml

format:
  pdf:
    pdf-engine: latexmk
    pdf-engine-opt: -xelatex
    documentclass: krantz
    include-in-header: 
      text: |
        \usepackage{makeidx}
        \makeindex
        \usepackage{fvextra}
        \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}
        \usepackage[titles]{tocloft}
        \cftsetindents{figure}{0em}{3.5em}
        \cftsetindents{table}{0em}{3.5em}
    include-before-body:
      text: |
        \RecustomVerbatimEnvironment{verbatim}{Verbatim}{
        showspaces = false,
        showtabs = false,
        breaksymbolleft={},
        breaklines
        % Note: setting commandchars=\\\{\} here will cause an error 
        }
    include-after-body: 
      text: |
        \printindex
    lof: true
    lot: true
    prefer-html: true
    toc: true
    number-sections: true
    colorlinks: true
    toc-depth: 5
    keep-md: false
    keep-tex: false
crossref:
  chapters: true
  lof-title: "List of Figures"
  lot-title: "List of Tables"

image

@cderv
Copy link
Collaborator

cderv commented Jun 2, 2023

I had a look into the KOMA script options. For anyone encountering this, you can pass option to KOMA using classoption.
This will handle the spacing for example.

format:
  pdf:
    classoption: 
      - listof=flat
    lof: true
    lot: true

Doc on KOMA explain this : https://mirrors.ircam.fr/pub/CTAN/macros/latex/contrib/koma-script/doc/scrguide-en.pdf

I wonder if we should make this option the default maybe 🤔 . A drawback is that it requires more latex runs to calculate the spacing, but we handle this nicely I believe.

Easy enough to change though once you know. @dragonstyle what do you think about our default and possible option to change ?

@dragonstyle
Copy link
Collaborator

Easy enough to change though once you know. @dragonstyle what do you think about our default and possible option to change ?

I think it would make sense to consider adding this as a part of a feature (e.g. list-of-figures: true), ensuring that we do the right thing... Features for generating lists of figures, tables, and so on would be pretty sweet as a general format wide feature.

@mcanouil
Copy link
Collaborator

mcanouil commented Jul 7, 2023

@mcanouil mcanouil added this to the v1.4 milestone Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants