Skip to content

Commit 3dfe0d2

Browse files
committed
Hopefully correct page margins for print!
1 parent 0d4a208 commit 3dfe0d2

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ src/version.tex
1010
*.pyg
1111
*.synctex(busy)
1212
src/.dotty-ide-disabled
13+
venv/*

shell.nix

+10-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,15 @@ mkShell {
4646
l3packages;
4747
})
4848
gnumake
49-
pythonPackages.pygments
5049
which
50+
git
51+
pythonPackages.virtualenv
52+
pythonPackages.pip
5153
];
52-
}
54+
shellHook = ''
55+
virtualenv --no-wheel --no-setuptools venv
56+
venv/bin/pip install -v https://github.com/hmemcpy/pygments-patched/archive/2.4.2-PATCHED.tar.gz
57+
venv/bin/pip install -v pygments-style-github
58+
source venv/bin/activate
59+
'';
60+
}

src/opt-print-ustrade.tex

+28-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
% !TEX root = ctfp-print.tex
1+
% !TeX program = xelatex
2+
% !TEX root = ctfp-print-scala.tex
23

34
\def\OPTmodes{twoside,final,openright,10pt}
45

5-
% PAGE FORMAT
6-
\def\OPTpagesize{6.125in,9.250in} % Page size
7-
\def\OPTtopmargin{0.75in} % Margin at the top of the page
8-
\def\OPTbottommargin{0.75in} % Margin at the bottom of the page
9-
\def\OPTinnermargin{0.5in} % Margin on the inner side of the page
10-
\def\OPTbindingoffset{0.35in} % Extra offset on the inner side
11-
\def\OPToutermargin{0.75in} % Margin on the outer side of the page
6+
% After struggling a while to get it right, here's how to calculate:
7+
% 1. Use the calculator to get your specifications
8+
% https://www.blurb.com/make/pdf_to_book/booksize_calculator
9+
% 2. Get the specifications. For a 6x9 hardcover (ImageWrap) book, I got:
10+
%
11+
% Page Specifications Inches
12+
% Final, exported PDF should measure (w x h) 6.125 x 9.25
13+
% Page size / trim line (w x h) 6.0 x 9.0
14+
% Bleed (top, bottom, and outside edges) 0.125
15+
% Safe boundary (Top, Bottom, Outside Edge) 0.25
16+
% Safe boundary (Binding Edge) 0.5
17+
%
18+
% 3. Trim line is at 0.625in, so to get safe text boundary (magenta line):
19+
% Top margin: 0.625in (start at trim line, header space fills to safe line)
20+
% Bottom margin: 0.625in + 0.25in = 0.875in
21+
% Inner margin: 0.625in (start on the trim line)
22+
% Binding offset: 0.5in
23+
% Outer margin: 0.625in + 0.25in = 0.875in
24+
25+
% Specifications for blurb.com
26+
\def\OPTpaperesize{6.125in,9.25in} % Page size
27+
\def\OPTtopmargin{.625in} % Margin at the top of the page
28+
\def\OPTbottommargin{0.875in} % Margin at the bottom of the page
29+
\def\OPTinnermargin{0.625in} % Margin on the inner side of the page
30+
\def\OPTbindingoffset{0.45in} % Extra offset on the inner side
31+
\def\OPToutermargin{0.625in} % Margin on the outer side of the page

src/preamble.tex

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
\documentclass[\OPTmodes]{book}
22

3-
\usepackage[papersize={\OPTpagesize},
3+
\usepackage[papersize={\OPTpaperesize},
44
top=\OPTtopmargin,
55
bottom=\OPTbottommargin,
66
inner=\OPTinnermargin,
@@ -12,6 +12,9 @@
1212
% New line height: 1.05 * 1.2 = 1.26
1313
\renewcommand{\baselinestretch}{1.05}
1414

15+
% Uncomment for diagnostics!
16+
% \usepackage[cam,width=6in,height=9in]{crop}
17+
1518
% Font settings
1619
%--------------------------------------------------------------% Note:
1720
\usepackage[no-math]{fontspec} % This exact order
@@ -193,7 +196,7 @@
193196
\end{mdframed}
194197
}
195198

196-
\newcommand{\acronym}[1]{\textsc{\fontspec[Numbers={OldStyle}]{Linux Libertine O}\MakeLowercase{#1}}}
199+
\newcommand{\acronym}[1]{\textsc{\MakeLowercase{#1}}}
197200
\newcommand{\newterm}[1]{\index{#1}\emph{#1}}
198201
\newcommand{\code}[1]{\Verb+{#1}+}
199202
\newcommand{\heading}[1]{{\sffamily\bfseries #1}}

0 commit comments

Comments
 (0)