Skip to content

Commit edb7ab2

Browse files
authored
Publish PDF (#1139)
* Publish PDF I had to update pinned nixpkgs, as it did not build with TexLive 2022. Some content annotations are not transformed very well in LaTex output. For example, there is a [bug](executablebooks/sphinx-design#107) in sphinx-design which prints dropdowns just as subsections without any visual highlighting. In general it is readable and better typeset compared to the PDF obtained by printing to PDF.
1 parent 75436d5 commit edb7ab2

File tree

5 files changed

+85
-17
lines changed

5 files changed

+85
-17
lines changed

default.nix

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,30 @@ let
1616
overlays = [ ];
1717
inherit system;
1818
};
19-
19+
nix-dev-python-pkgs = with pkgs.python3.pkgs; [
20+
linkify-it-py
21+
myst-parser
22+
sphinx
23+
sphinx-book-theme
24+
sphinx-copybutton
25+
sphinx-design
26+
sphinx-notfound-page
27+
sphinx-sitemap
28+
pkgs.perl
29+
];
30+
# generated with nix run github:rgri/tex2nix -- *.tex *.sty
31+
nix-dev-latex = [ (pkgs.callPackage ./nix/tex-env.nix {
32+
extraTexPackages = {
33+
inherit (pkgs.texlive) latexmk gnu-freefont;
34+
};
35+
}) ];
2036
nix-dev =
2137
pkgs.stdenv.mkDerivation {
2238
name = "nix-dev";
2339
src = ./.;
24-
nativeBuildInputs = with pkgs.python3.pkgs; [
25-
linkify-it-py
26-
myst-parser
27-
sphinx
28-
sphinx-book-theme
29-
sphinx-copybutton
30-
sphinx-design
31-
sphinx-notfound-page
32-
sphinx-sitemap
33-
pkgs.perl
40+
nativeBuildInputs = [
41+
nix-dev-python-pkgs
42+
nix-dev-latex
3443
];
3544
buildPhase =
3645
let
@@ -42,6 +51,7 @@ let
4251
''
4352
${lib.optionalString withManuals "cp -f ${substitutedNixManualReference} source/reference/nix-manual.md"}
4453
make html
54+
make latexpdf
4555
'';
4656
installPhase =
4757
let
@@ -68,6 +78,7 @@ let
6878
''
6979
mkdir -p $out/manual/nix
7080
cp -R build/html/* $out/
81+
cp build/latex/nix-dev.pdf $out/
7182
'' + lib.optionalString withManuals ''
7283
${lib.concatStringsSep "\n" (lib.mapAttrsToList release releases.nixReleases)}
7384
${lib.concatStringsSep "\n" (lib.mapAttrsToList mutableRedirect releases.mutableNixManualRedirects)}

nix/tex-env.nix

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Generated with tex2nix 0.0.0
2+
{ texlive, extraTexPackages ? {} }:
3+
(texlive.combine ({
4+
inherit (texlive) scheme-small;
5+
"amsmath" = texlive."amsmath";
6+
"atbegshi" = texlive."atbegshi";
7+
"atveryend" = texlive."atveryend";
8+
"bitset" = texlive."bitset";
9+
"capt-of" = texlive."capt-of";
10+
"cmap" = texlive."cmap";
11+
"colortbl" = texlive."colortbl";
12+
"etexcmds" = texlive."etexcmds";
13+
"etoolbox" = texlive."etoolbox";
14+
"fancyvrb" = texlive."fancyvrb";
15+
"float" = texlive."float";
16+
"fncychap" = texlive."fncychap";
17+
"fontspec" = texlive."fontspec";
18+
"framed" = texlive."framed";
19+
"geometry" = texlive."geometry";
20+
"gettitlestring" = texlive."gettitlestring";
21+
"hopatch" = texlive."hopatch";
22+
"hycolor" = texlive."hycolor";
23+
"hypcap" = texlive."hypcap";
24+
"hyperref" = texlive."hyperref";
25+
"iftex" = texlive."iftex";
26+
"infwarerr" = texlive."infwarerr";
27+
"intcalc" = texlive."intcalc";
28+
"kvdefinekeys" = texlive."kvdefinekeys";
29+
"kvoptions" = texlive."kvoptions";
30+
"kvsetkeys" = texlive."kvsetkeys";
31+
"letltxmacro" = texlive."letltxmacro";
32+
"ltxcmds" = texlive."ltxcmds";
33+
"minitoc" = texlive."minitoc";
34+
"needspace" = texlive."needspace";
35+
"ntheorem" = texlive."ntheorem";
36+
"parskip" = texlive."parskip";
37+
"pdfescape" = texlive."pdfescape";
38+
"pdftexcmds" = texlive."pdftexcmds";
39+
"polyglossia" = texlive."polyglossia";
40+
"refcount" = texlive."refcount";
41+
"rerunfilecheck" = texlive."rerunfilecheck";
42+
"stringenc" = texlive."stringenc";
43+
"tabulary" = texlive."tabulary";
44+
"titlesec" = texlive."titlesec";
45+
"uniquecounter" = texlive."uniquecounter";
46+
"upquote" = texlive."upquote";
47+
"url" = texlive."url";
48+
"varwidth" = texlive."varwidth";
49+
"wrapfig" = texlive."wrapfig";
50+
"xcolor" = texlive."xcolor";
51+
52+
} // extraTexPackages))

source/_static/_img/nix.pdf

5.32 KB
Binary file not shown.

source/_templates/download-links.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>nix.dev as <a href="nix-dev.pdf">PDF</p>

source/conf.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
"about.html",
202202
"search-field.html",
203203
"sbt-sidebar-nav.html",
204+
"download-links.html",
204205
],
205206
}
206207

@@ -260,9 +261,11 @@
260261
# The font size ('10pt', '11pt' or '12pt').
261262
#'pointsize': '10pt',
262263
# Additional stuff for the LaTeX preamble.
263-
'preamble': '\setcounter{tocdepth}{3}',
264+
'preamble': r'\setcounter{tocdepth}{2}',
265+
'sphinxsetup': r'TitleColor={RGB}{87, 154, 202}',
264266
# Latex figure (float) alignment
265267
#'figure_align': 'htbp',
268+
266269
}
267270

268271
# Grouping the document tree into LaTeX files. List of tuples
@@ -271,17 +274,18 @@
271274
latex_documents = [
272275
(
273276
master_doc,
274-
"nixpkgs-cookbook.tex",
275-
"nixpkgs-cookbook Documentation",
277+
"nix-dev.tex",
278+
"nix.dev",
276279
"nix.dev contributors",
277280
"manual",
281+
True, # toctree only
278282
),
279283
]
280284

281285
latex_engine = "xelatex"
282286
# The name of an image file (relative to this directory) to place at the top of
283287
# the title page.
284-
# latex_logo = None
288+
latex_logo = "_static/_img/nix.pdf"
285289

286290
# For "manual" documents, if this is true, then toplevel headings are parts,
287291
# not chapters.
@@ -290,10 +294,10 @@
290294
latex_use_xindy = False
291295

292296
# If true, show page references after internal links.
293-
# latex_show_pagerefs = False
297+
latex_show_pagerefs = True
294298

295299
# If true, show URL addresses after external links.
296-
# latex_show_urls = False
300+
latex_show_urls = 'footnote'
297301

298302
# Documents to append as an appendix to all manuals.
299303
# latex_appendices = []

0 commit comments

Comments
 (0)