crowdagger/crowbook

Page numbers offset in TOC by -10

Closed this issue · 4 comments

Page numbers are offset in TOC by -10.

Image 1 (click to reveal) image
Image 2 (click to reveal) image

Side note: Although the images here show the use of a custom LaTeX template, I can reproduce this with the LaTeX template shipping with crowbook.

XeTeX    : 3.14159265-2.6-0.999991 (TeX Live 2019)
crowbook : v0.15.0
OS       : macOS Catalina 10.15.2 (19C57)
hardware : MBP 15" 2018, i9 2.9GHz, 32GB, 1TB, Radeon Pro 560X

@lise-henry It seems this is an issue with the generate_pdf in src/lib/zipper.rs.


Looking at an old solution (without using crowbook) that worked for me:

#!/bin/bash

errors=0

function run_pdflatex_cmd {
    pdflatex -synctex=1 --shell-escape -interaction=batchmode XXXXXX.tex
    exitcode=$?
    if [ $errors == 0 -a $exitcode != 0 ]; then errors=$exitcode ; fi
}

function run_biber_cmd {
    biber XXXXXX
    exitcode=$?
    if [ $errors == 0 -a $exitcode != 0 ]; then errors=$exitcode ; fi
}

function run_extras_cmd {
    makeglossaries XXXXXX
    makeindex XXXXXX.idx
    makeindex XXXXXX.nlo -s XXXXXX.ist -o XXXXXX.nls
    exitcode=$?
    if [ $errors == 0 -a $exitcode != 0 ]; then errors=$exitcode ; fi
}

function clean_up {
    rm -f *.{acn,acr,alg,aux,bbl,tex.bbl,bcf,blg,tex.blg,dvi,gin,glg,gls,glo,idx,ilg,ind,ist,lof,lot,nlo,nls,ptc,out,ptc,run.xml,toc,synctex.gz,synctex.gz\(busy\)}
    mv XXXXXX.pdf ../output/pdflatex/XXXXXX.pdf
    mv XXXXXX.log ../output/pdflatex/XXXXXX.log
    # open ../output/pdflatex/XXXXXX.pdf
}

run_pdflatex_cmd
run_biber_cmd
run_pdflatex_cmd
run_biber_cmd
run_extras_cmd
run_pdflatex_cmd
run_pdflatex_cmd
clean_up

exit $errors

it seems we can add:

\usepackage{imakeidx}
\makeindex[intoc]

to templates/latex/template.tex and change generate_pdf in src/lib/zipper.rs from:

  • first run
  • second run

to:

  • first run
  • extras similar to above code
  • second run
  • third run (if I recall correctly, this was needed in my old setup)

Any thoughts? Haven't tested output. This is just a suggestion to try, while looking through my old repositories where I used LaTeX.

Thanks for noting it. I'll look into it but I don't have much time for that right now, it'll probably have to be in february.

Addind a third LaTeX pass seems, indeed, to fix this. I'm not sure why running e.g. makeindex would be necessary? I don't think you can mark index elements with Markdown?

fixed in 89eb960