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

Page numbers offset in TOC by -10 #70

Closed
jrappen opened this issue Dec 28, 2019 · 4 comments
Closed

Page numbers offset in TOC by -10 #70

jrappen opened this issue Dec 28, 2019 · 4 comments
Labels

Comments

@jrappen
Copy link
Contributor

jrappen commented Dec 28, 2019

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
@jrappen
Copy link
Contributor Author

jrappen commented Jan 6, 2020

@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.

@crowdagger crowdagger added the bug label Jan 16, 2020
@crowdagger
Copy link
Owner

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.

@crowdagger
Copy link
Owner

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?

@jrappen
Copy link
Contributor Author

jrappen commented Apr 26, 2020

fixed in 89eb960

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants