JuliaBooks / Books.jl

Create books with Julia
https://huijzer.xyz/Books.jl/
Other
270 stars 18 forks source link

H4 in markdown breaking pdf() #265

Closed athulsudheesh closed 2 years ago

athulsudheesh commented 2 years ago

When I have Heading level 4 in my markdown, the package is failing to create the pdf version

This is the error message I get:

Wrote _build/IJML.tex (for debugging purposes)
warning: texput.tex:526: Overfull \hbox (11.80602pt too wide) in paragraph at lines 524--526
error: texput.tex:528: Class tufte-book Error:
(tufte-book)              \subsubsectionis undefined by this class. See Robert
(tufte-book)              Bringhurst's _The Elements of Typographic Style_, section
(tufte-book)              4.2.2. \subsubsectionwas used

See the tufte-book class documentation for explanation.
Type  H <return>  for immediate help
error: halted on potentially-recoverable error as specified
Error producing PDF.
! Class tufte-book Error:
(tufte-book)              \subsubsectionis undefined by this class. See Robert
(tufte-book)              Bringhurst's _The Elements of Typographic Style_, sec
tion
(tufte-book)              4.2.2. \subsubsectionwas used

See the tufte-book class documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.528 ...bsection{testign 4th}\label{testign-4th}}

ERROR: failed process: Process(`/Users/athulsudheesh/.julia/artifacts/18d8d7b9998f5b9327177969288be2daeb5d4031/bin/pandoc _gen/input.md --filter=/Users/athulsudheesh/.julia/artifacts/2c9e222ff27286dc754c48a924f24b6237baec34/bin/pandoc-crossref --citeproc --csl=/Users/athulsudheesh/.julia/packages/Books/YydNn/defaults/style.csl --metadata-file=_gen/metadata.yml --template=/Users/athulsudheesh/.julia/packages/Books/YydNn/defaults/template.tex --lua-filter=/Users/athulsudheesh/.julia/packages/Books/YydNn/src/output-block.lua --listings --pdf-engine=/Users/athulsudheesh/.julia/artifacts/1fa5a6a617eb3345cb6baf67f288d9d935954a46/tectonic --pdf-engine-opt=--print --variable=listings-unicode-path:/Users/athulsudheesh/.julia/packages/Books/YydNn/defaults/julia_listings_unicode.tex --variable=listings-path:/Users/athulsudheesh/.julia/packages/Books/YydNn/defaults/julia_listings.tex --variable=build-info:2021-12-15 --number-sections --top-level-division=chapter --output=_build/IJML.pdf`, ProcessExited(43)) [43]

Stacktrace:
  [1] pipeline_error
    @ ./process.jl:531 [inlined]
  [2] run(::Base.CmdRedirect; wait::Bool)
    @ Base ./process.jl:446
  [3] run
    @ ./process.jl:444 [inlined]
  [4] (::Books.var"#17#18"{Vector{String}})(pandoc_bin::String)
    @ Books ~/.julia/packages/Books/YydNn/src/build.jl:58
  [5] (::JLLWrappers.var"#2#3"{Books.var"#17#18"{Vector{String}}, String})()
    @ JLLWrappers ~/.julia/packages/JLLWrappers/bkwIo/src/runtime.jl:49
  [6] withenv(::JLLWrappers.var"#2#3"{Books.var"#17#18"{Vector{String}}, String}, ::Pair{String, String}, ::Vararg{Pair{String, String}})
    @ Base ./env.jl:172
  [7] withenv_executable_wrapper(f::Function, executable_path::String, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool)
    @ JLLWrappers ~/.julia/packages/JLLWrappers/bkwIo/src/runtime.jl:48
  [8] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./essentials.jl:716
  [9] invokelatest(::Any, ::Any, ::Vararg{Any})
    @ Base ./essentials.jl:714
 [10] pandoc(f::Function; adjust_PATH::Bool, adjust_LIBPATH::Bool)
    @ pandoc_jll ~/.julia/packages/JLLWrappers/bkwIo/src/products/executable_generators.jl:7
 [11] pandoc(f::Function)
    @ pandoc_jll ~/.julia/packages/JLLWrappers/bkwIo/src/products/executable_generators.jl:7
 [12] call_pandoc(args::Vector{String})
    @ Books ~/.julia/packages/Books/YydNn/src/build.jl:55
 [13] pdf(; project::String)
    @ Books ~/.julia/packages/Books/YydNn/src/build.jl:349
 [14] pdf()
    @ Books ~/.julia/packages/Books/YydNn/src/build.jl:309
 [15] top-level scope
    @ REPL[8]:1
rikhuijzer commented 2 years ago

That is because the Tufte book disables level 4 headers by default. Tufte argues that those should never be used in a book.

You can either decide to skip using level 4 headers or use this override from the default template.tex:

https://github.com/JuliaBooks/Books.jl/blob/efd89bf717b2cfb5d9bb1fe16eb4f19baafe4efd/defaults/template.tex#L194-L202

In other words, to enable subsubsections, you can set allow-subsubsections: true in the metadata.yml.