From 31be46ae412e7d376be42fdc8d5ce1d0cf09ac1c Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 00:49:57 +0800 Subject: [PATCH 01/24] [TeX] Allow custom preamble --- src/Writers/LaTeXWriter.jl | 110 ++++++++++++++++++++++--------------- 1 file changed, 65 insertions(+), 45 deletions(-) diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl index 99c9bba452..a85c77a513 100644 --- a/src/Writers/LaTeXWriter.jl +++ b/src/Writers/LaTeXWriter.jl @@ -214,55 +214,75 @@ end function writeheader(io::IO, doc::Documents.Document) custom = joinpath(doc.user.root, doc.user.source, "assets", "custom.sty") isfile(custom) ? cp(custom, "custom.sty"; force = true) : touch("custom.sty") + preamble = """ - \\documentclass[oneside]{memoir} - - \\usepackage{./documenter} - \\usepackage{./custom} - - %% Title Page - \\title{ - {\\HUGE $(doc.user.sitename)}\\\\ - {\\Large $(get(ENV, "TRAVIS_TAG", ""))} - } - \\author{$(doc.user.authors)} - - %% TOC settings - % -- TOC depth - % value: [part, chapter, section, subsection, - % subsubsection, paragraph, subparagraph] - \\settocdepth{section} % show "part+chapter+section" in TOC - % -- TOC spacing - % ref: https://tex.stackexchange.com/questions/60317/toc-spacing-in-memoir - % doc: memoir/memman.pdf - % - Figure 9.2: Layout of a ToC - % - Table 9.3: Value of K in macros for styling entries - \\makeatletter - % {part} to {chaper} - \\setlength{\\cftbeforepartskip}{1.5em \\@plus \\p@} - % {chaper} to {chaper} - \\setlength{\\cftbeforechapterskip}{0.0em \\@plus \\p@} - % Chapter num to chapter title spacing (Figure 9.2@memman) - \\setlength{\\cftchapternumwidth}{2.5em \\@plus \\p@} - % indent before section number - \\setlength{\\cftsectionindent}{2.5em \\@plus \\p@} - % Section num to section title spacing (Figure 9.2@memman) - \\setlength{\\cftsectionnumwidth}{4.0em \\@plus \\p@} - \\makeatother - - %% Main document begin - \\begin{document} - - \\frontmatter - \\maketitle - \\clearpage - \\tableofcontents - - \\mainmatter - + \\newcommand{\\DocMainTitle}{$(doc.user.sitename)} + \\newcommand{\\DocVersion}{$(get(ENV, "TRAVIS_TAG", ""))} + \\newcommand{\\DocAuthors}{$(doc.user.authors)} """ _println(io, preamble) + preamble_tex_file = joinpath(doc.user.root, doc.user.source, "assets", "preamble.tex") + if isfile(preamble_tex_file) + # copy custom preamble, and insert the whole file. + cp(custom, "preamble.tex"; force = true) + preamble = + """ + % ---- Insert custom preamble + \\input{preamble.tex} + """ + else # no custom preamble.tex, use default Settings + preamble = + """ + \\documentclass[oneside]{memoir} + + \\usepackage{./documenter} + \\usepackage{./custom} + + %% Title Page + \\title{ + {\\HUGE $(doc.user.sitename)}\\\\ + {\\Large $(get(ENV, "TRAVIS_TAG", ""))} + } + \\author{$(doc.user.authors)} + + %% TOC settings + % -- TOC depth + % value: [part, chapter, section, subsection, + % subsubsection, paragraph, subparagraph] + \\settocdepth{section} % show "part+chapter+section" in TOC + % -- TOC spacing + % ref: https://tex.stackexchange.com/questions/60317/toc-spacing-in-memoir + % doc: memoir/memman.pdf + % - Figure 9.2: Layout of a ToC + % - Table 9.3: Value of K in macros for styling entries + \\makeatletter + % {part} to {chaper} + \\setlength{\\cftbeforepartskip}{1.5em \\@plus \\p@} + % {chaper} to {chaper} + \\setlength{\\cftbeforechapterskip}{0.0em \\@plus \\p@} + % Chapter num to chapter title spacing (Figure 9.2@memman) + \\setlength{\\cftchapternumwidth}{2.5em \\@plus \\p@} + % indent before section number + \\setlength{\\cftsectionindent}{2.5em \\@plus \\p@} + % Section num to section title spacing (Figure 9.2@memman) + \\setlength{\\cftsectionnumwidth}{4.0em \\@plus \\p@} + \\makeatother + + %% Main document begin + \\begin{document} + + \\frontmatter + \\maketitle + \\clearpage + \\tableofcontents + + \\mainmatter + """ + end + + # output preamble + _println(io, preamble) end function writefooter(io::IO, doc::Documents.Document) From a8fd79578c901fff313ae6d24c0c80c2a34c77ee Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 00:57:50 +0800 Subject: [PATCH 02/24] [TeX] Keep default preamble untouched --- src/Writers/LaTeXWriter.jl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl index a85c77a513..0f77b27687 100644 --- a/src/Writers/LaTeXWriter.jl +++ b/src/Writers/LaTeXWriter.jl @@ -215,19 +215,17 @@ function writeheader(io::IO, doc::Documents.Document) custom = joinpath(doc.user.root, doc.user.source, "assets", "custom.sty") isfile(custom) ? cp(custom, "custom.sty"; force = true) : touch("custom.sty") - preamble = - """ - \\newcommand{\\DocMainTitle}{$(doc.user.sitename)} - \\newcommand{\\DocVersion}{$(get(ENV, "TRAVIS_TAG", ""))} - \\newcommand{\\DocAuthors}{$(doc.user.authors)} - """ - _println(io, preamble) preamble_tex_file = joinpath(doc.user.root, doc.user.source, "assets", "preamble.tex") if isfile(preamble_tex_file) # copy custom preamble, and insert the whole file. cp(custom, "preamble.tex"; force = true) preamble = """ + % Useful variables + \\newcommand{\\DocMainTitle}{$(doc.user.sitename)} + \\newcommand{\\DocVersion}{$(get(ENV, "TRAVIS_TAG", ""))} + \\newcommand{\\DocAuthors}{$(doc.user.authors)} + % ---- Insert custom preamble \\input{preamble.tex} """ From 9c786140077ad128a2eb43a092c8f7eead8096a6 Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 13:24:25 +0800 Subject: [PATCH 03/24] [TeX] fix typo --- src/Writers/LaTeXWriter.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl index 0f77b27687..bd053eb18b 100644 --- a/src/Writers/LaTeXWriter.jl +++ b/src/Writers/LaTeXWriter.jl @@ -218,7 +218,7 @@ function writeheader(io::IO, doc::Documents.Document) preamble_tex_file = joinpath(doc.user.root, doc.user.source, "assets", "preamble.tex") if isfile(preamble_tex_file) # copy custom preamble, and insert the whole file. - cp(custom, "preamble.tex"; force = true) + cp(preamble_tex_file, "preamble.tex"; force = true) preamble = """ % Useful variables From e3932d88f68793f96f8a937461bb93d082d4f2ec Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 14:36:03 +0800 Subject: [PATCH 04/24] [TeX] add a cover_page example --- test/cover_page/make.jl | 10 +++++++++ test/cover_page/src/assets/cover.png | Bin 0 -> 8830 bytes test/cover_page/src/assets/preamble.tex | 16 ++++++++++++++ test/cover_page/src/assets/titlepage.tex | 26 +++++++++++++++++++++++ test/cover_page/src/index.md | 3 +++ 5 files changed, 55 insertions(+) create mode 100644 test/cover_page/make.jl create mode 100644 test/cover_page/src/assets/cover.png create mode 100644 test/cover_page/src/assets/preamble.tex create mode 100644 test/cover_page/src/assets/titlepage.tex create mode 100644 test/cover_page/src/index.md diff --git a/test/cover_page/make.jl b/test/cover_page/make.jl new file mode 100644 index 0000000000..95310dcf5e --- /dev/null +++ b/test/cover_page/make.jl @@ -0,0 +1,10 @@ +using Documenter + +makedocs( + format = Documenter.LaTeX(platform = "docker"), + sitename = "PDF Cover Page", + pages = [ + "Home" => "index.md", + ], + authors = "The Julia Project", +) diff --git a/test/cover_page/src/assets/cover.png b/test/cover_page/src/assets/cover.png new file mode 100644 index 0000000000000000000000000000000000000000..e90368a1cf1e95189a757ef6c63316239effa04a GIT binary patch literal 8830 zcmdsdc{El3`!5L*AydYLC_=>{q!Kb^N}?Be3$PEb-}vDgnEK3u(eH8(dGkH>Rza#B!GCnO~7lgYFc z6lC&FT3TviVq!^2Nq&BQS$X+0?i1uK3;7wVcL5~-?Jh1Z*&EMePzv6t^P&+jKf(G~faxTcya%;_t*oN*$jV;b z_TM?MekMg<^_En!9`kzzhJ_t6jg$wkgo>u}O=?b=d{gezjLaqT2a}VNxT+uTGAl)1 zluKGC<8q_o|B2w${qX$hb5#R#|ED*<+QUp`*yMznr#B9|XSVGs*2Ajja++psa)${` zgX>ehUERG+^$lC&)m&zITir=j*yxwu5o6d7rq1ubX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8wR$GsIL=y}qUnB8zjB=izcWq9rX)%6tG37w6kM zw+9SA!FtF>zH5%ykmWBc*6wPuTmo(doUXn({9E_5Cwsqr;84NoP7x`op2~zSJJ3FL zfW;-n=rBG7y|~O0e0SUZHfB{WlAD(6x`)inaEpJ}SIAY&t*W95zjykD|27pTo^fjd z(5$ZNbs=q*L!=rLc_hJH`7YYNa(2fD_3fi{=AxUlJpK2!f>ph=|J^~9;0|0yo!2=$6y|m=ZJ9j3! zCn;Cr86a-*Sbu@(TVK323_L0n%5{?u4xyC}QWyC#b5>jJByEN@(+lB`` z@%Zr8De(!5$Ulqgjsxzz^+hbP&E8Vp#f=n2NQuV^U({j0u!8sbqXstc!74P+DqZ1Un*%X=g5I-p6se>-n8 Date: Wed, 6 Apr 2022 15:14:31 +0800 Subject: [PATCH 05/24] [TeX] add a toc-style example --- test/toc-style/make.jl | 10 +++++++ .../src/assets/default-customized.png | Bin 0 -> 13031 bytes test/toc-style/src/assets/preamble.tex | 25 ++++++++++++++++ test/toc-style/src/index.md | 28 ++++++++++++++++++ 4 files changed, 63 insertions(+) create mode 100644 test/toc-style/make.jl create mode 100644 test/toc-style/src/assets/default-customized.png create mode 100644 test/toc-style/src/assets/preamble.tex create mode 100644 test/toc-style/src/index.md diff --git a/test/toc-style/make.jl b/test/toc-style/make.jl new file mode 100644 index 0000000000..8da74a94c3 --- /dev/null +++ b/test/toc-style/make.jl @@ -0,0 +1,10 @@ +using Documenter + +makedocs( + format = Documenter.LaTeX(platform = "docker"), + sitename = "LaTeX TOC Depth", + pages = [ + "Part-I" => "index.md", + ], + authors = "The Julia Project", +) diff --git a/test/toc-style/src/assets/default-customized.png b/test/toc-style/src/assets/default-customized.png new file mode 100644 index 0000000000000000000000000000000000000000..75f40db427f9c5c91b8cacc061018bd49ef24e7a GIT binary patch literal 13031 zcmch7bx@qqlJDT|1STOsa1v|=cV{3tL4wQRF2UV((BLkC;7))5!8JgFySrO(dy~7n zwQujfKVIFc-KwdtzB#8)cc1P)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a/test/toc-style/src/assets/preamble.tex b/test/toc-style/src/assets/preamble.tex new file mode 100644 index 0000000000..f36b4e1b13 --- /dev/null +++ b/test/toc-style/src/assets/preamble.tex @@ -0,0 +1,25 @@ +\documentclass[oneside]{memoir} +\usepackage{./documenter} +\usepackage{./custom} + +%% Title Page +\title{ + {\HUGE \DocMainTitle }\\ + {\Large \DocVersion } +} +\author{ \DocAuthors } + +%% TOC settings +% -- TOC depth +% value: [part, chapter, section, subsection, +% subsubsection, paragraph, subparagraph] +\settocdepth{chapter} % show "part+chapter" in TOC + + +%% Main document begin +\begin{document} +\frontmatter +\maketitle +\clearpage +\tableofcontents +\mainmatter diff --git a/test/toc-style/src/index.md b/test/toc-style/src/index.md new file mode 100644 index 0000000000..9ac00854e4 --- /dev/null +++ b/test/toc-style/src/index.md @@ -0,0 +1,28 @@ +# LaTeX backend test case: LaTeX TOC style + + +With the default settings of `Documenter.jl`, the section name will be displayed in the TOC. + +```tex +%% TOC settings +% -- TOC depth +% value: [part, chapter, section, subsection, +% subsubsection, paragraph, subparagraph] +\settocdepth{section} % show "part+chapter+section" in TOC +``` + +You can modify settings that related to the TOC format by add customized `preamble.tex`. + +## Only show part and chapter in TOC + +```tex +\settocdepth{part} % show "part+chapter" in TOC +``` + +## Default style vs. custom style + +Left side: default style, show "part+chapter+section" in TOC. + +Right side: custom style, show "part+chapter" in TOC. + +![default vs. customized](./assets/default-customized.png) From ea0f13c636598c1947d21981f7470e4e94809bb0 Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 15:17:06 +0800 Subject: [PATCH 06/24] [test] Add new test to runtest --- test/runtests.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 7a823b51ee..cb9a57953a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -78,4 +78,13 @@ include("TestUtilities.jl"); using .TestUtilities # Running doctest() on our own manual @info "doctest() Documenter's manual" @quietly include("manual.jl") + + @testset "LaTeX backend custom style" begin + @info "Building cover_page/make.jl" + @quietly include("cover_page/make.jl") + + @info "Building toc-style/make.jl" + @quietly include("toc-style/make.jl") + end + end From 6cbc706816cf0bd2e0382570dffe5c7363ff90ac Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 15:21:00 +0800 Subject: [PATCH 07/24] [TeX] use snake case filename --- test/runtests.jl | 4 ++-- test/{toc-style => toc_style}/make.jl | 0 .../src/assets/default-customized.png | Bin .../src/assets/preamble.tex | 0 test/{toc-style => toc_style}/src/index.md | 0 5 files changed, 2 insertions(+), 2 deletions(-) rename test/{toc-style => toc_style}/make.jl (100%) rename test/{toc-style => toc_style}/src/assets/default-customized.png (100%) rename test/{toc-style => toc_style}/src/assets/preamble.tex (100%) rename test/{toc-style => toc_style}/src/index.md (100%) diff --git a/test/runtests.jl b/test/runtests.jl index cb9a57953a..fafdc4e180 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -83,8 +83,8 @@ include("TestUtilities.jl"); using .TestUtilities @info "Building cover_page/make.jl" @quietly include("cover_page/make.jl") - @info "Building toc-style/make.jl" - @quietly include("toc-style/make.jl") + @info "Building toc_style/make.jl" + @quietly include("toc_style/make.jl") end end diff --git a/test/toc-style/make.jl b/test/toc_style/make.jl similarity index 100% rename from test/toc-style/make.jl rename to test/toc_style/make.jl diff --git a/test/toc-style/src/assets/default-customized.png b/test/toc_style/src/assets/default-customized.png similarity index 100% rename from test/toc-style/src/assets/default-customized.png rename to test/toc_style/src/assets/default-customized.png diff --git a/test/toc-style/src/assets/preamble.tex b/test/toc_style/src/assets/preamble.tex similarity index 100% rename from test/toc-style/src/assets/preamble.tex rename to test/toc_style/src/assets/preamble.tex diff --git a/test/toc-style/src/index.md b/test/toc_style/src/index.md similarity index 100% rename from test/toc-style/src/index.md rename to test/toc_style/src/index.md From 9c6a06397be56f4b37e2999b21328e6f5e3b0866 Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 15:23:05 +0800 Subject: [PATCH 08/24] [TeX] move to dir --- test/{ => LaTeX_backend}/cover_page/make.jl | 0 .../cover_page/src/assets/cover.png | Bin .../cover_page/src/assets/preamble.tex | 0 .../cover_page/src/assets/titlepage.tex | 0 test/{ => LaTeX_backend}/cover_page/src/index.md | 0 test/{ => LaTeX_backend}/toc_style/make.jl | 0 .../toc_style/src/assets/default-customized.png | Bin .../toc_style/src/assets/preamble.tex | 0 test/{ => LaTeX_backend}/toc_style/src/index.md | 0 test/runtests.jl | 8 ++++---- 10 files changed, 4 insertions(+), 4 deletions(-) rename test/{ => LaTeX_backend}/cover_page/make.jl (100%) rename test/{ => LaTeX_backend}/cover_page/src/assets/cover.png (100%) rename test/{ => LaTeX_backend}/cover_page/src/assets/preamble.tex (100%) rename test/{ => LaTeX_backend}/cover_page/src/assets/titlepage.tex (100%) rename test/{ => LaTeX_backend}/cover_page/src/index.md (100%) rename test/{ => LaTeX_backend}/toc_style/make.jl (100%) rename test/{ => LaTeX_backend}/toc_style/src/assets/default-customized.png (100%) rename test/{ => LaTeX_backend}/toc_style/src/assets/preamble.tex (100%) rename test/{ => LaTeX_backend}/toc_style/src/index.md (100%) diff --git a/test/cover_page/make.jl b/test/LaTeX_backend/cover_page/make.jl similarity index 100% rename from test/cover_page/make.jl rename to test/LaTeX_backend/cover_page/make.jl diff --git a/test/cover_page/src/assets/cover.png b/test/LaTeX_backend/cover_page/src/assets/cover.png similarity index 100% rename from test/cover_page/src/assets/cover.png rename to test/LaTeX_backend/cover_page/src/assets/cover.png diff --git a/test/cover_page/src/assets/preamble.tex b/test/LaTeX_backend/cover_page/src/assets/preamble.tex similarity index 100% rename from test/cover_page/src/assets/preamble.tex rename to test/LaTeX_backend/cover_page/src/assets/preamble.tex diff --git a/test/cover_page/src/assets/titlepage.tex b/test/LaTeX_backend/cover_page/src/assets/titlepage.tex similarity index 100% rename from test/cover_page/src/assets/titlepage.tex rename to test/LaTeX_backend/cover_page/src/assets/titlepage.tex diff --git a/test/cover_page/src/index.md b/test/LaTeX_backend/cover_page/src/index.md similarity index 100% rename from test/cover_page/src/index.md rename to test/LaTeX_backend/cover_page/src/index.md diff --git a/test/toc_style/make.jl b/test/LaTeX_backend/toc_style/make.jl similarity index 100% rename from test/toc_style/make.jl rename to test/LaTeX_backend/toc_style/make.jl diff --git a/test/toc_style/src/assets/default-customized.png b/test/LaTeX_backend/toc_style/src/assets/default-customized.png similarity index 100% rename from test/toc_style/src/assets/default-customized.png rename to test/LaTeX_backend/toc_style/src/assets/default-customized.png diff --git a/test/toc_style/src/assets/preamble.tex b/test/LaTeX_backend/toc_style/src/assets/preamble.tex similarity index 100% rename from test/toc_style/src/assets/preamble.tex rename to test/LaTeX_backend/toc_style/src/assets/preamble.tex diff --git a/test/toc_style/src/index.md b/test/LaTeX_backend/toc_style/src/index.md similarity index 100% rename from test/toc_style/src/index.md rename to test/LaTeX_backend/toc_style/src/index.md diff --git a/test/runtests.jl b/test/runtests.jl index fafdc4e180..8d3832d9f7 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -80,11 +80,11 @@ include("TestUtilities.jl"); using .TestUtilities @quietly include("manual.jl") @testset "LaTeX backend custom style" begin - @info "Building cover_page/make.jl" - @quietly include("cover_page/make.jl") + @info "Building LaTeX_backend/cover_page" + @quietly include("LaTeX_backend/cover_page/make.jl") - @info "Building toc_style/make.jl" - @quietly include("toc_style/make.jl") + @info "Building LaTeX_backend/toc_style" + @quietly include("LaTeX_backend/toc_style/make.jl") end end From 74620119675c294a2f4ab6217eea5190c799fc9e Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 16:37:31 +0800 Subject: [PATCH 09/24] [test] only build PDF on ubuntu --- .github/workflows/CI.yml | 1 + test/run_latex_test.jl | 13 +++++++++++++ test/runtests.jl | 8 -------- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 test/run_latex_test.jl diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b703754d98..2a8fcc2a60 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -58,6 +58,7 @@ jobs: Pkg.develop(PackageSpec(path=pwd())) Pkg.add(["IOCapture", "DocumenterMarkdown"])' - run: julia --project=test/examples --code-coverage test/examples/tests_latex.jl + - run: julia --project=test/examples --code-coverage test/run_latex_test.jl - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: diff --git a/test/run_latex_test.jl b/test/run_latex_test.jl new file mode 100644 index 0000000000..167367b79c --- /dev/null +++ b/test/run_latex_test.jl @@ -0,0 +1,13 @@ +using Test +import Documenter +include("TestUtilities.jl"); using .TestUtilities + +@testset "Examples/LaTeX" begin + @testset "LaTeX backend custom style" begin + @info "Building LaTeX_backend/cover_page" + @quietly include("LaTeX_backend/cover_page/make.jl") + + @info "Building LaTeX_backend/toc_style" + @quietly include("LaTeX_backend/toc_style/make.jl") + end +end diff --git a/test/runtests.jl b/test/runtests.jl index 8d3832d9f7..c5d294fa6d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -78,13 +78,5 @@ include("TestUtilities.jl"); using .TestUtilities # Running doctest() on our own manual @info "doctest() Documenter's manual" @quietly include("manual.jl") - - @testset "LaTeX backend custom style" begin - @info "Building LaTeX_backend/cover_page" - @quietly include("LaTeX_backend/cover_page/make.jl") - - @info "Building LaTeX_backend/toc_style" - @quietly include("LaTeX_backend/toc_style/make.jl") - end end From 7bf8de95c2010d0086c807e856872b7f4aae9eb1 Mon Sep 17 00:00:00 2001 From: woclass Date: Wed, 6 Apr 2022 16:44:15 +0800 Subject: [PATCH 10/24] [test/tex] rename testset --- test/run_latex_test.jl | 4 ++-- test/runtests.jl | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/run_latex_test.jl b/test/run_latex_test.jl index 167367b79c..39a273d271 100644 --- a/test/run_latex_test.jl +++ b/test/run_latex_test.jl @@ -2,8 +2,8 @@ using Test import Documenter include("TestUtilities.jl"); using .TestUtilities -@testset "Examples/LaTeX" begin - @testset "LaTeX backend custom style" begin +@testset "LaTeX backend" begin + @testset "custom style" begin @info "Building LaTeX_backend/cover_page" @quietly include("LaTeX_backend/cover_page/make.jl") diff --git a/test/runtests.jl b/test/runtests.jl index c5d294fa6d..7a823b51ee 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -78,5 +78,4 @@ include("TestUtilities.jl"); using .TestUtilities # Running doctest() on our own manual @info "doctest() Documenter's manual" @quietly include("manual.jl") - end From 015a68aa0e6b68354098311744d4100151f817eb Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 20:34:26 +0800 Subject: [PATCH 11/24] [repo] Add CHANGELOG entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7efd4bc1ec..f92cf011de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * ![Enhancement][badge-enhancement] Update CSS source file for JuliaMono, so that all font variations are included (not just `JuliaMono Regular`) and that the latest version (0.039 -> 0.044) of the font would be used. ([#1780][github-1780], [#1784][github-1784]) * ![Bugfix][badge-bugfix] Fix `strict` mode to properly print errors, not just a warnings. ([#1756][github-1756], [#1776][github-1776]) +* ![Enhancement][badge-enhancement] Better spacing between section number and title. ([#1785][github-1785]) +* ![Enhancement][badge-enhancement] Allow custom preamble. ([#1788][github-1788]) ## Version `v0.27.15` @@ -996,6 +998,8 @@ [github-1776]: https://github.com/JuliaDocs/Documenter.jl/pull/1776 [github-1780]: https://github.com/JuliaDocs/Documenter.jl/issues/1780 [github-1784]: https://github.com/JuliaDocs/Documenter.jl/pull/1784 +[github-1785]: https://github.com/JuliaDocs/Documenter.jl/pull/1785 +[github-1788]: https://github.com/JuliaDocs/Documenter.jl/pull/1788 [julia-38079]: https://github.com/JuliaLang/julia/issues/38079 From adf8259b18bc19eefa6c148ad63facb26a86c1bb Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 21:00:31 +0800 Subject: [PATCH 12/24] [TeX] moving preamble into separate file --- assets/latex/preamble.tex | 46 +++++++++++++++++++++++ src/Writers/LaTeXWriter.jl | 76 ++++++++------------------------------ 2 files changed, 61 insertions(+), 61 deletions(-) create mode 100644 assets/latex/preamble.tex diff --git a/assets/latex/preamble.tex b/assets/latex/preamble.tex new file mode 100644 index 0000000000..ebc265e56b --- /dev/null +++ b/assets/latex/preamble.tex @@ -0,0 +1,46 @@ +%% Default preamble BEGIN +\documentclass[oneside]{memoir} + +\usepackage{./documenter} +\usepackage{./custom} + +%% Title Page +\title{ + {\HUGE \DocMainTitle }\\ + {\Large \DocVersion } +} +\author{ \DocAuthors } + +%% TOC settings +% -- TOC depth +% value: [part, chapter, section, subsection, +% subsubsection, paragraph, subparagraph] +\settocdepth{section} % show "part+chapter+section" in TOC +% -- TOC spacing +% ref: https://tex.stackexchange.com/questions/60317/toc-spacing-in-memoir +% doc: memoir/memman.pdf +% - Figure 9.2: Layout of a ToC +% - Table 9.3: Value of K in macros for styling entries +\makeatletter +% {part} to {chaper} +\setlength{\cftbeforepartskip}{1.5em \@plus \p@} +% {chaper} to {chaper} +\setlength{\cftbeforechapterskip}{0.0em \@plus \p@} +% Chapter num to chapter title spacing (Figure 9.2@memman) +\setlength{\cftchapternumwidth}{2.5em \@plus \p@} +% indent before section number +\setlength{\cftsectionindent}{2.5em \@plus \p@} +% Section num to section title spacing (Figure 9.2@memman) +\setlength{\cftsectionnumwidth}{4.0em \@plus \p@} +\makeatother + +%% Main document begin +\begin{document} + +\frontmatter +\maketitle +\clearpage +\tableofcontents + +\mainmatter +%% preamble END \ No newline at end of file diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl index bd053eb18b..b1f1a81873 100644 --- a/src/Writers/LaTeXWriter.jl +++ b/src/Writers/LaTeXWriter.jl @@ -75,6 +75,7 @@ _println(c::Context, args...) = Base.println(c.io, args...) const STYLE = joinpath(dirname(@__FILE__), "..", "..", "assets", "latex", "documenter.sty") +const DEFAULT_PREAMBLE_PATH = joinpath(dirname(@__FILE__), "..", "..", "assets", "latex", "preamble.tex") hastex() = (try; success(`latexmk -version`); catch; false; end) @@ -217,68 +218,21 @@ function writeheader(io::IO, doc::Documents.Document) preamble_tex_file = joinpath(doc.user.root, doc.user.source, "assets", "preamble.tex") if isfile(preamble_tex_file) - # copy custom preamble, and insert the whole file. + # copy custom preamble. cp(preamble_tex_file, "preamble.tex"; force = true) - preamble = - """ - % Useful variables - \\newcommand{\\DocMainTitle}{$(doc.user.sitename)} - \\newcommand{\\DocVersion}{$(get(ENV, "TRAVIS_TAG", ""))} - \\newcommand{\\DocAuthors}{$(doc.user.authors)} - - % ---- Insert custom preamble - \\input{preamble.tex} - """ - else # no custom preamble.tex, use default Settings - preamble = - """ - \\documentclass[oneside]{memoir} - - \\usepackage{./documenter} - \\usepackage{./custom} - - %% Title Page - \\title{ - {\\HUGE $(doc.user.sitename)}\\\\ - {\\Large $(get(ENV, "TRAVIS_TAG", ""))} - } - \\author{$(doc.user.authors)} - - %% TOC settings - % -- TOC depth - % value: [part, chapter, section, subsection, - % subsubsection, paragraph, subparagraph] - \\settocdepth{section} % show "part+chapter+section" in TOC - % -- TOC spacing - % ref: https://tex.stackexchange.com/questions/60317/toc-spacing-in-memoir - % doc: memoir/memman.pdf - % - Figure 9.2: Layout of a ToC - % - Table 9.3: Value of K in macros for styling entries - \\makeatletter - % {part} to {chaper} - \\setlength{\\cftbeforepartskip}{1.5em \\@plus \\p@} - % {chaper} to {chaper} - \\setlength{\\cftbeforechapterskip}{0.0em \\@plus \\p@} - % Chapter num to chapter title spacing (Figure 9.2@memman) - \\setlength{\\cftchapternumwidth}{2.5em \\@plus \\p@} - % indent before section number - \\setlength{\\cftsectionindent}{2.5em \\@plus \\p@} - % Section num to section title spacing (Figure 9.2@memman) - \\setlength{\\cftsectionnumwidth}{4.0em \\@plus \\p@} - \\makeatother - - %% Main document begin - \\begin{document} - - \\frontmatter - \\maketitle - \\clearpage - \\tableofcontents - - \\mainmatter - """ - end - + else # no custom preamble.tex, use default. + cp(DEFAULT_PREAMBLE_PATH, "preamble.tex"; force = true) + end + preamble = + """ + % Useful variables + \\newcommand{\\DocMainTitle}{$(doc.user.sitename)} + \\newcommand{\\DocVersion}{$(get(ENV, "TRAVIS_TAG", ""))} + \\newcommand{\\DocAuthors}{$(doc.user.authors)} + + % ---- Insert preamble + \\input{preamble.tex} + """ # output preamble _println(io, preamble) end From b2060aa8324a171dbedda4369fbf676484883a31 Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 21:03:23 +0800 Subject: [PATCH 13/24] [TeX] rename `preamble_tex_file` to `custom_preamble_file` --- src/Writers/LaTeXWriter.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl index b1f1a81873..69bb2cbfc9 100644 --- a/src/Writers/LaTeXWriter.jl +++ b/src/Writers/LaTeXWriter.jl @@ -216,10 +216,10 @@ function writeheader(io::IO, doc::Documents.Document) custom = joinpath(doc.user.root, doc.user.source, "assets", "custom.sty") isfile(custom) ? cp(custom, "custom.sty"; force = true) : touch("custom.sty") - preamble_tex_file = joinpath(doc.user.root, doc.user.source, "assets", "preamble.tex") - if isfile(preamble_tex_file) + custom_preamble_file = joinpath(doc.user.root, doc.user.source, "assets", "preamble.tex") + if isfile(custom_preamble_file) # copy custom preamble. - cp(preamble_tex_file, "preamble.tex"; force = true) + cp(custom_preamble_file, "preamble.tex"; force = true) else # no custom preamble.tex, use default. cp(DEFAULT_PREAMBLE_PATH, "preamble.tex"; force = true) end From 947997f5714adf62847ac867eb4b7f241743d08b Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 21:35:25 +0800 Subject: [PATCH 14/24] [test] move TeX examples to `test/examples` --- .github/workflows/CI.yml | 1 - test/LaTeX_backend/cover_page/make.jl | 10 ----- test/LaTeX_backend/toc_style/make.jl | 10 ----- test/examples/make.jl | 38 ++++++++++++++++++ .../src.cover_page}/assets/cover.png | Bin .../src.cover_page}/assets/preamble.tex | 0 .../src.cover_page}/assets/titlepage.tex | 0 .../src => examples/src.cover_page}/index.md | 0 .../assets/default-customized.png | Bin .../src.toc_style}/assets/preamble.tex | 0 .../src => examples/src.toc_style}/index.md | 0 test/examples/tests_latex.jl | 19 ++++++++- test/run_latex_test.jl | 13 ------ 13 files changed, 56 insertions(+), 35 deletions(-) delete mode 100644 test/LaTeX_backend/cover_page/make.jl delete mode 100644 test/LaTeX_backend/toc_style/make.jl rename test/{LaTeX_backend/cover_page/src => examples/src.cover_page}/assets/cover.png (100%) rename test/{LaTeX_backend/cover_page/src => examples/src.cover_page}/assets/preamble.tex (100%) rename test/{LaTeX_backend/cover_page/src => examples/src.cover_page}/assets/titlepage.tex (100%) rename test/{LaTeX_backend/cover_page/src => examples/src.cover_page}/index.md (100%) rename test/{LaTeX_backend/toc_style/src => examples/src.toc_style}/assets/default-customized.png (100%) rename test/{LaTeX_backend/toc_style/src => examples/src.toc_style}/assets/preamble.tex (100%) rename test/{LaTeX_backend/toc_style/src => examples/src.toc_style}/index.md (100%) delete mode 100644 test/run_latex_test.jl diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2a8fcc2a60..b703754d98 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -58,7 +58,6 @@ jobs: Pkg.develop(PackageSpec(path=pwd())) Pkg.add(["IOCapture", "DocumenterMarkdown"])' - run: julia --project=test/examples --code-coverage test/examples/tests_latex.jl - - run: julia --project=test/examples --code-coverage test/run_latex_test.jl - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: diff --git a/test/LaTeX_backend/cover_page/make.jl b/test/LaTeX_backend/cover_page/make.jl deleted file mode 100644 index 95310dcf5e..0000000000 --- a/test/LaTeX_backend/cover_page/make.jl +++ /dev/null @@ -1,10 +0,0 @@ -using Documenter - -makedocs( - format = Documenter.LaTeX(platform = "docker"), - sitename = "PDF Cover Page", - pages = [ - "Home" => "index.md", - ], - authors = "The Julia Project", -) diff --git a/test/LaTeX_backend/toc_style/make.jl b/test/LaTeX_backend/toc_style/make.jl deleted file mode 100644 index 8da74a94c3..0000000000 --- a/test/LaTeX_backend/toc_style/make.jl +++ /dev/null @@ -1,10 +0,0 @@ -using Documenter - -makedocs( - format = Documenter.LaTeX(platform = "docker"), - sitename = "LaTeX TOC Depth", - pages = [ - "Part-I" => "index.md", - ], - authors = "The Julia Project", -) diff --git a/test/examples/make.jl b/test/examples/make.jl index 5f3da4a630..52a20cdae3 100644 --- a/test/examples/make.jl +++ b/test/examples/make.jl @@ -486,3 +486,41 @@ else @debug "Controlling variables:" EXAMPLE_BUILDS get(ENV, "DOCUMENTER_TEST_EXAMPLES", nothing) nothing end + +examples_latex_cover_page = if "latex_cover_page" in EXAMPLE_BUILDS + @info("Building mock package docs: LaTeXWriter/latex_cover_page") + @quietly makedocs( + format = Documenter.Writers.LaTeXWriter.LaTeX(platform = "docker"), + sitename = "PDF Cover Page", + root = examples_root, + build = "builds/latex_cover_page", + source = "src.cover_page", + pages = ["Home" => "index.md"], + authors = "The Julia Project", + doctest = false, + debug = true, + ) +else + @info "Skipping build: LaTeXWriter/latex_cover_page" + @debug "Controlling variables:" EXAMPLE_BUILDS get(ENV, "DOCUMENTER_TEST_EXAMPLES", nothing) + nothing +end + +examples_latex_toc_style = if "latex_toc_style" in EXAMPLE_BUILDS + @info("Building mock package docs: LaTeXWriter/latex_toc_style") + @quietly makedocs( + format = Documenter.Writers.LaTeXWriter.LaTeX(platform = "docker"), + sitename = "LaTeX TOC Depth", + root = examples_root, + build = "builds/latex_toc_style", + source = "src.toc_style", + pages = ["Part-I" => "index.md"], + authors = "The Julia Project", + doctest = false, + debug = true, + ) +else + @info "Skipping build: LaTeXWriter/latex_toc_style" + @debug "Controlling variables:" EXAMPLE_BUILDS get(ENV, "DOCUMENTER_TEST_EXAMPLES", nothing) + nothing +end diff --git a/test/LaTeX_backend/cover_page/src/assets/cover.png b/test/examples/src.cover_page/assets/cover.png similarity index 100% rename from test/LaTeX_backend/cover_page/src/assets/cover.png rename to test/examples/src.cover_page/assets/cover.png diff --git a/test/LaTeX_backend/cover_page/src/assets/preamble.tex b/test/examples/src.cover_page/assets/preamble.tex similarity index 100% rename from test/LaTeX_backend/cover_page/src/assets/preamble.tex rename to test/examples/src.cover_page/assets/preamble.tex diff --git a/test/LaTeX_backend/cover_page/src/assets/titlepage.tex b/test/examples/src.cover_page/assets/titlepage.tex similarity index 100% rename from test/LaTeX_backend/cover_page/src/assets/titlepage.tex rename to test/examples/src.cover_page/assets/titlepage.tex diff --git a/test/LaTeX_backend/cover_page/src/index.md b/test/examples/src.cover_page/index.md similarity index 100% rename from test/LaTeX_backend/cover_page/src/index.md rename to test/examples/src.cover_page/index.md diff --git a/test/LaTeX_backend/toc_style/src/assets/default-customized.png b/test/examples/src.toc_style/assets/default-customized.png similarity index 100% rename from test/LaTeX_backend/toc_style/src/assets/default-customized.png rename to test/examples/src.toc_style/assets/default-customized.png diff --git a/test/LaTeX_backend/toc_style/src/assets/preamble.tex b/test/examples/src.toc_style/assets/preamble.tex similarity index 100% rename from test/LaTeX_backend/toc_style/src/assets/preamble.tex rename to test/examples/src.toc_style/assets/preamble.tex diff --git a/test/LaTeX_backend/toc_style/src/index.md b/test/examples/src.toc_style/index.md similarity index 100% rename from test/LaTeX_backend/toc_style/src/index.md rename to test/examples/src.toc_style/index.md diff --git a/test/examples/tests_latex.jl b/test/examples/tests_latex.jl index a6183201bd..9656f5859a 100644 --- a/test/examples/tests_latex.jl +++ b/test/examples/tests_latex.jl @@ -2,7 +2,8 @@ using Test # DOCUMENTER_TEST_EXAMPLES can be used to control which builds are performed in # make.jl, and we need to set it to the relevant LaTeX builds. -ENV["DOCUMENTER_TEST_EXAMPLES"] = "latex latex_simple latex_texonly" +ENV["DOCUMENTER_TEST_EXAMPLES"] = + "latex latex_simple latex_texonly latex_cover_page latex_toc_style" # When the file is run separately we need to include make.jl which actually builds # the docs and defines a few modules that are referred to in the docs. The make.jl @@ -49,4 +50,20 @@ end @test joinpath(build_dir, "documenter.sty") |> isfile end end + + @testset "PDF/LaTeX: Custom Cover Page" begin + doc = Main.examples_latex_cover_page + @test isa(doc, Documenter.Documents.Document) + let build_dir = joinpath(examples_root, "builds", "latex_cover_page") + @test joinpath(build_dir, "DocumenterLaTeX$(tagsuffix).pdf") |> isfile + end + end + + @testset "PDF/LaTeX: Custom TOC Style" begin + doc = Main.examples_latex_toc_style + @test isa(doc, Documenter.Documents.Document) + let build_dir = joinpath(examples_root, "builds", "latex_toc_style") + @test joinpath(build_dir, "DocumenterLaTeX$(tagsuffix).pdf") |> isfile + end + end end diff --git a/test/run_latex_test.jl b/test/run_latex_test.jl deleted file mode 100644 index 39a273d271..0000000000 --- a/test/run_latex_test.jl +++ /dev/null @@ -1,13 +0,0 @@ -using Test -import Documenter -include("TestUtilities.jl"); using .TestUtilities - -@testset "LaTeX backend" begin - @testset "custom style" begin - @info "Building LaTeX_backend/cover_page" - @quietly include("LaTeX_backend/cover_page/make.jl") - - @info "Building LaTeX_backend/toc_style" - @quietly include("LaTeX_backend/toc_style/make.jl") - end -end From f204fa0ed0ba80ec341c8bf976fdd3b8a1d855b0 Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 21:39:32 +0800 Subject: [PATCH 15/24] [test] Use same sitename --- test/examples/make.jl | 4 ++-- test/examples/tests_latex.jl | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/examples/make.jl b/test/examples/make.jl index 52a20cdae3..9b4ed247ec 100644 --- a/test/examples/make.jl +++ b/test/examples/make.jl @@ -491,7 +491,7 @@ examples_latex_cover_page = if "latex_cover_page" in EXAMPLE_BUILDS @info("Building mock package docs: LaTeXWriter/latex_cover_page") @quietly makedocs( format = Documenter.Writers.LaTeXWriter.LaTeX(platform = "docker"), - sitename = "PDF Cover Page", + sitename = "Documenter LaTeX", root = examples_root, build = "builds/latex_cover_page", source = "src.cover_page", @@ -510,7 +510,7 @@ examples_latex_toc_style = if "latex_toc_style" in EXAMPLE_BUILDS @info("Building mock package docs: LaTeXWriter/latex_toc_style") @quietly makedocs( format = Documenter.Writers.LaTeXWriter.LaTeX(platform = "docker"), - sitename = "LaTeX TOC Depth", + sitename = "Documenter LaTeX", root = examples_root, build = "builds/latex_toc_style", source = "src.toc_style", diff --git a/test/examples/tests_latex.jl b/test/examples/tests_latex.jl index 9656f5859a..683eade89c 100644 --- a/test/examples/tests_latex.jl +++ b/test/examples/tests_latex.jl @@ -2,8 +2,10 @@ using Test # DOCUMENTER_TEST_EXAMPLES can be used to control which builds are performed in # make.jl, and we need to set it to the relevant LaTeX builds. +# ENV["DOCUMENTER_TEST_EXAMPLES"] = +# "latex latex_simple latex_texonly latex_cover_page latex_toc_style" ENV["DOCUMENTER_TEST_EXAMPLES"] = - "latex latex_simple latex_texonly latex_cover_page latex_toc_style" + "latex_cover_page latex_toc_style" # When the file is run separately we need to include make.jl which actually builds # the docs and defines a few modules that are referred to in the docs. The make.jl From 3a256de736e30f80708b8f463667219a434029ab Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 21:44:00 +0800 Subject: [PATCH 16/24] [test] open all test --- test/examples/tests_latex.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/examples/tests_latex.jl b/test/examples/tests_latex.jl index 683eade89c..9656f5859a 100644 --- a/test/examples/tests_latex.jl +++ b/test/examples/tests_latex.jl @@ -2,10 +2,8 @@ using Test # DOCUMENTER_TEST_EXAMPLES can be used to control which builds are performed in # make.jl, and we need to set it to the relevant LaTeX builds. -# ENV["DOCUMENTER_TEST_EXAMPLES"] = -# "latex latex_simple latex_texonly latex_cover_page latex_toc_style" ENV["DOCUMENTER_TEST_EXAMPLES"] = - "latex_cover_page latex_toc_style" + "latex latex_simple latex_texonly latex_cover_page latex_toc_style" # When the file is run separately we need to include make.jl which actually builds # the docs and defines a few modules that are referred to in the docs. The make.jl From 430c06a7778a85ab80d9fa858aeaa12a013f0513 Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 21:55:37 +0800 Subject: [PATCH 17/24] [ci] upload PDF artifact --- .github/workflows/CI.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b703754d98..315e381c69 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -62,6 +62,10 @@ jobs: - uses: codecov/codecov-action@v1 with: file: lcov.info + - uses: actions/upload-artifact@v3 + with: + name: PDFs + path: test/examples/builds/*/*.pdf themes: name: "CSS for HTML themes" From 585c9c9ecc37da3c0310ea1644ef6972e1b1eab4 Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 22:36:55 +0800 Subject: [PATCH 18/24] [doc] add doc for Custom LaTeX style --- docs/src/man/other-formats.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/src/man/other-formats.md b/docs/src/man/other-formats.md index d8b4c0c1cb..20def896c6 100644 --- a/docs/src/man/other-formats.md +++ b/docs/src/man/other-formats.md @@ -71,6 +71,34 @@ makedocs( ) ``` +## [Custom LaTeX style](@id custom-latex) + +### Load custom packages + +We have loaded many common packages in LaTeX, +such as `fontspec`, `amsmath`, `listings`, `minted`, `tabulary`, `graphicx`, +and more detailed configurations can be found in [`documenter.sty`](https://github.com/JuliaDocs/Documenter.jl/blob/master/assets/latex/documenter.sty). + +Users can load more custom packages by adding a `custom.sty` to the `assert/` folder, +and the custom style (`custom.sty`) will be loaded after the default style (`documenter.sty`). + +### Custom preamble + +If you wish to fully customize the package loading, you need to write a custom preamble. + +The default preamble is currently defined in [`preamble.tex`](https://github.com/JuliaDocs/Documenter.jl/blob/master/assets/latex/preamble.tex). +You can override the default preamble completely by adding a custom `preamble.tex` to the `assert/` folder. + +There are two examples of custom preambles: +- Custom [cover page][cover_page_src], ([make.jl][cover_page_makejl]) +- Customizing [the TOC display][toc_display_src], ([make.jl][toc_display_makejl]) + +[cover_page_src]: https://github.com/JuliaDocs/Documenter.jl/tree/master/test/examples/src.cover_page +[toc_display_src]: https://github.com/JuliaDocs/Documenter.jl/tree/master/test/examples/src.toc_style +[cover_page_makejl]: https://github.com/JuliaDocs/Documenter.jl/blob/master/test/examples/make.jl#L492-L502 +[toc_display_makejl]: https://github.com/JuliaDocs/Documenter.jl/blob/master/test/examples/make.jl#L511-L521 + + ## Markdown & MkDocs Markdown output requires the [`DocumenterMarkdown`](https://github.com/JuliaDocs/DocumenterMarkdown.jl) From e0a2c6ff937d0f111a4f7fca7811185f51a0b050 Mon Sep 17 00:00:00 2001 From: woclass Date: Fri, 8 Apr 2022 22:44:03 +0800 Subject: [PATCH 19/24] [doc] Temporarily pointing the link to the folder --- docs/src/man/other-formats.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/man/other-formats.md b/docs/src/man/other-formats.md index 20def896c6..0eb7a75f78 100644 --- a/docs/src/man/other-formats.md +++ b/docs/src/man/other-formats.md @@ -86,7 +86,7 @@ and the custom style (`custom.sty`) will be loaded after the default style (`doc If you wish to fully customize the package loading, you need to write a custom preamble. -The default preamble is currently defined in [`preamble.tex`](https://github.com/JuliaDocs/Documenter.jl/blob/master/assets/latex/preamble.tex). +The default preamble is currently defined in [`preamble.tex`](https://github.com/JuliaDocs/Documenter.jl/blob/master/assets/latex/). You can override the default preamble completely by adding a custom `preamble.tex` to the `assert/` folder. There are two examples of custom preambles: From 5ced82248f34fb935e98280b08e26d41205f6e31 Mon Sep 17 00:00:00 2001 From: woclass Date: Sun, 10 Apr 2022 16:53:03 +0800 Subject: [PATCH 20/24] Apply suggestions from code review ( mortenpi ) Co-authored-by: Morten Piibeleht --- CHANGELOG.md | 4 ++-- docs/src/man/other-formats.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f92cf011de..1d6728cba3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,8 @@ * ![Enhancement][badge-enhancement] Update CSS source file for JuliaMono, so that all font variations are included (not just `JuliaMono Regular`) and that the latest version (0.039 -> 0.044) of the font would be used. ([#1780][github-1780], [#1784][github-1784]) * ![Bugfix][badge-bugfix] Fix `strict` mode to properly print errors, not just a warnings. ([#1756][github-1756], [#1776][github-1776]) -* ![Enhancement][badge-enhancement] Better spacing between section number and title. ([#1785][github-1785]) -* ![Enhancement][badge-enhancement] Allow custom preamble. ([#1788][github-1788]) +* ![Enhancement][badge-enhancement] The table of contents in the generated PDFs have more space between section numbers and titles to avoid them overlapping. ([#1785][github-1785]) +* ![Enhancement][badge-enhancement] The preamble of the LaTeX source of the PDF build can now be customized by the user. ([#1746][github-1746], [#1788][github-1788]) ## Version `v0.27.15` diff --git a/docs/src/man/other-formats.md b/docs/src/man/other-formats.md index 0eb7a75f78..62761cbe17 100644 --- a/docs/src/man/other-formats.md +++ b/docs/src/man/other-formats.md @@ -79,15 +79,15 @@ We have loaded many common packages in LaTeX, such as `fontspec`, `amsmath`, `listings`, `minted`, `tabulary`, `graphicx`, and more detailed configurations can be found in [`documenter.sty`](https://github.com/JuliaDocs/Documenter.jl/blob/master/assets/latex/documenter.sty). -Users can load more custom packages by adding a `custom.sty` to the `assert/` folder, +Users can load more custom packages by adding a `custom.sty` to the `assets/` folder, and the custom style (`custom.sty`) will be loaded after the default style (`documenter.sty`). ### Custom preamble If you wish to fully customize the package loading, you need to write a custom preamble. -The default preamble is currently defined in [`preamble.tex`](https://github.com/JuliaDocs/Documenter.jl/blob/master/assets/latex/). -You can override the default preamble completely by adding a custom `preamble.tex` to the `assert/` folder. +The default preamble is currently defined in [`preamble.tex`](https://github.com/JuliaDocs/Documenter.jl/blob/master/assets/latex/preamble.tex). +You can override the default preamble completely by adding a custom `preamble.tex` to the `assets/` folder. There are two examples of custom preambles: - Custom [cover page][cover_page_src], ([make.jl][cover_page_makejl]) From c488b9f4535f194934826b00e726cd27f9896be6 Mon Sep 17 00:00:00 2001 From: woclass Date: Sun, 10 Apr 2022 16:55:03 +0800 Subject: [PATCH 21/24] [repo] Add link in CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d6728cba3..8d2bb29c29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -980,6 +980,7 @@ [github-1716]: https://github.com/JuliaDocs/Documenter.jl/pull/1716 [github-1727]: https://github.com/JuliaDocs/Documenter.jl/pull/1727 [github-1743]: https://github.com/JuliaDocs/Documenter.jl/pull/1743 +[github-1746]: https://github.com/JuliaDocs/Documenter.jl/issues/1746 [github-1748]: https://github.com/JuliaDocs/Documenter.jl/pull/1748 [github-1750]: https://github.com/JuliaDocs/Documenter.jl/pull/1750 [github-1751]: https://github.com/JuliaDocs/Documenter.jl/pull/1751 From 465b3d587d722c7a2d5d350db27bb6f5a994503f Mon Sep 17 00:00:00 2001 From: woclass Date: Sun, 10 Apr 2022 17:09:25 +0800 Subject: [PATCH 22/24] [tex] rename `DocVersion` to `deprecatedEnvTravisTag` We may add `DocVersion` back later --- assets/latex/preamble.tex | 2 +- src/Writers/LaTeXWriter.jl | 3 ++- test/examples/src.cover_page/assets/titlepage.tex | 2 +- test/examples/src.toc_style/assets/preamble.tex | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/latex/preamble.tex b/assets/latex/preamble.tex index ebc265e56b..ee38e43e86 100644 --- a/assets/latex/preamble.tex +++ b/assets/latex/preamble.tex @@ -7,7 +7,7 @@ %% Title Page \title{ {\HUGE \DocMainTitle }\\ - {\Large \DocVersion } + {\Large \deprecatedEnvTravisTag } } \author{ \DocAuthors } diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl index 69bb2cbfc9..d56b0661dc 100644 --- a/src/Writers/LaTeXWriter.jl +++ b/src/Writers/LaTeXWriter.jl @@ -227,7 +227,8 @@ function writeheader(io::IO, doc::Documents.Document) """ % Useful variables \\newcommand{\\DocMainTitle}{$(doc.user.sitename)} - \\newcommand{\\DocVersion}{$(get(ENV, "TRAVIS_TAG", ""))} + % Warning: The default value of \\deprecatedEnvTravisTag is deprecated. + \\newcommand{\\deprecatedEnvTravisTag}{$(get(ENV, "TRAVIS_TAG", ""))} \\newcommand{\\DocAuthors}{$(doc.user.authors)} % ---- Insert preamble diff --git a/test/examples/src.cover_page/assets/titlepage.tex b/test/examples/src.cover_page/assets/titlepage.tex index 599172d883..57fff7c93c 100644 --- a/test/examples/src.cover_page/assets/titlepage.tex +++ b/test/examples/src.cover_page/assets/titlepage.tex @@ -19,7 +19,7 @@ \\[1.5cm] \Large -\DocVersion +\deprecatedEnvTravisTag \today \end{center} diff --git a/test/examples/src.toc_style/assets/preamble.tex b/test/examples/src.toc_style/assets/preamble.tex index f36b4e1b13..553e924736 100644 --- a/test/examples/src.toc_style/assets/preamble.tex +++ b/test/examples/src.toc_style/assets/preamble.tex @@ -5,7 +5,7 @@ %% Title Page \title{ {\HUGE \DocMainTitle }\\ - {\Large \DocVersion } + {\Large \deprecatedEnvTravisTag } } \author{ \DocAuthors } From 777f41ac151630fca5c77aac41700bd3b45dfe13 Mon Sep 17 00:00:00 2001 From: woclass Date: Mon, 11 Apr 2022 10:01:32 +0800 Subject: [PATCH 23/24] [tex] Add new tex variable: `\JuliaVersion` --- src/Writers/LaTeXWriter.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Writers/LaTeXWriter.jl b/src/Writers/LaTeXWriter.jl index d56b0661dc..db6957875c 100644 --- a/src/Writers/LaTeXWriter.jl +++ b/src/Writers/LaTeXWriter.jl @@ -230,6 +230,7 @@ function writeheader(io::IO, doc::Documents.Document) % Warning: The default value of \\deprecatedEnvTravisTag is deprecated. \\newcommand{\\deprecatedEnvTravisTag}{$(get(ENV, "TRAVIS_TAG", ""))} \\newcommand{\\DocAuthors}{$(doc.user.authors)} + \\newcommand{\\JuliaVersion}{$(VERSION)} % ---- Insert preamble \\input{preamble.tex} From 028d1031edf41849ff97c55cd4d30868accbf22a Mon Sep 17 00:00:00 2001 From: woclass Date: Mon, 11 Apr 2022 10:03:42 +0800 Subject: [PATCH 24/24] [test] Use new tex variable in test --- test/examples/src.cover_page/assets/titlepage.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/examples/src.cover_page/assets/titlepage.tex b/test/examples/src.cover_page/assets/titlepage.tex index 57fff7c93c..ddad39c4df 100644 --- a/test/examples/src.cover_page/assets/titlepage.tex +++ b/test/examples/src.cover_page/assets/titlepage.tex @@ -8,7 +8,7 @@ \\[0.6cm] %% ---- Subtitle -{\LARGE Subtitle } +{\LARGE Built by Julia \JuliaVersion } \vspace*{3cm}\par\noindent \textbf{ \DocAuthors }