Debian Codegraph @

texmf-dist/doc/latex/xfakebold/xfakebold-doc.tex

raw
1 % $Id: xfakebold-doc.tex 820 2023-11-21 15:10:21Z herbert $
2 \listfiles
3 \documentclass[english]{article}
4 \usepackage{dejavu-otf}
5 \usepackage{xfp,dtk-logos}
6 \ExplSyntaxOn
7 \let\PI\c_pi_fp
8 \ExplSyntaxOff
9 \usepackage{xfakebold}
10 \usepackage{graphicx}
11 %\pdfcompresslevel=0
12 \usepackage{babel}
13 \usepackage[a4paper,tmargin=1cm,bmargin=1.5cm,includeheadfoot]{geometry}
14 \usepackage{listings}
15 \title{\texttt{xfakebold}, v. 0.10\\ using bold characters with\\ \texttt{pdflatex}, \texttt{lualatex} or \texttt{xelatex}}
16 \author{Herbert Voß}
17
18 \lstset{basicstyle=\ttfamily\small,language={[LaTeX]TeX},frame=lrtb}
19 \begin{document}
20
21 \maketitle
22
23 \tableofcontents
24
25 \vspace{1cm}
26 \begin{abstract}
27 The package fakes a vector font with outline characters by the text render of PDF.
28 It writes directly into the pdf output with \verb|\pdfliteral| and uses the colorstack package \texttt{pdfrender} to allow
29 boldness with a pagebreak inside the bold part.
30 %(pdflatex ) or \verb|\pdfextension| \verb|literal|
31 %(lualatex) or \verb|\special| (xelatex).
32 The package defines two macros which can be used in text and in math mode. However, for the text
33 mode one should use the bold version of the text font which should be available in most cases. This is different to the
34 math mode where only some free math fonts provide a bold version.
35 \end{abstract}
36
37 \vfill
38 \small Thanks to: Yukai Chou; Martin Münch; Heiko Oberdiek;
39 Scott Pakin, Will Robertson; Yusuke Terada;
40 %\meaning\setBold
41
42 %\meaning\unsetBold
43
44 \newpage
45
46 \section{\TeX-engines}
47 With \XeLaTeX\ you do not really need this package, because you can use the optional argument \texttt{AutoFakeBold} from
48 package \texttt{fontspec} or \texttt{unicode-math} which does the same internally. For Lua\TeX\ the option \texttt{AutoFakeBold} is only supported
49 by \texttt{unicode-math} for math typesetting. For pdf\LaTeX\ this package can be used for text and math.
50
51
52 \section{How does it work?}
53 PDF knows different text render modes for outline fonts.
54
55 \bigskip
56 \ifxetex\else% Only for the test run with xelatex
57
58 \def\OFF{\pdfrender{TextRenderingMode=Fill,LineWidth=0}}
59 \def\Verb|#1|{\texttt{\{#1\}}}
60
61 \makebox[3cm][l]{Mode 0 \Verb| 0 Tr 0 w |} \tabular{l}\pdfrender{TextRenderingMode=Fill}\scalebox{10}{OTTO} OTTO\OFF\endtabular
62
63 \makebox[3cm][l]{Mode 1 \Verb| 1 Tr 0 w |} \tabular{l}\pdfrender{TextRenderingMode=Stroke,LineWidth=0}\scalebox{10}{OTTO} OTTO\OFF\endtabular
64
65 \makebox[3cm][l]{Mode 1 \Verb| 1 Tr 0.3 w |} \tabular{l}\pdfrender{TextRenderingMode=Stroke,LineWidth=0.3}\scalebox{10}{OTTO} OTTO\OFF\endtabular
66
67 \makebox[3cm][l]{Mode 2 \Verb| 2 Tr 0 w |} \tabular{l}\pdfrender{TextRenderingMode=FillStroke,LineWidth=0}\scalebox{10}{OTTO} OTTO\OFF\endtabular
68
69 \makebox[3cm][l]{Mode 2 \Verb| 2 Tr 0.3 w |} \tabular{l}\pdfrender{TextRenderingMode=FillStroke,LineWidth=0.3}\scalebox{10}{OTTO} OTTO\OFF\endtabular
70 \fi
71
72 \bigskip
73 In mode 0 the character is filled but without drawing its outline which can be seen when printing in mode 1, where
74 the linewidth of the outline is the smallest one which the system allows. Setting the linewidth to 0.3\,bp, which is
75 nearly the same as 0.3\,pt, the linewidth of the outline increases. In mode 2 the character is printed with filling \emph{and}
76 drawing the outline, which is mode 0 and 1 together. The reason why the character is bold by default. Increasing the linewidth
77 makes it more bold.
78
79
80 \section{Optional package argument}
81 The only package option is \verb|bold| which is preset by 0.3, which is the linewidth of
82 the outlines of the characters.
83
84 \begin{lstlisting}
85 \usepackage[bold=0.6]{xfakebold}
86 \end{lstlisting}
87
88 makes the characters more bold.
89
90 \section{The macros}
91
92 \begin{lstlisting}
93 \setBold[<optional value>]
94 \unsetBold
95 \end{lstlisting}
96
97 Without using the optional argument the default setting is used.
98
99
100
101
102 \section{The example code}
103
104 The following examples use the value for $\pi$, defined in \LaTeX3 as \verb|\c_pi_fp|. To get rid of
105 the L3-syntax we define a new variable:
106
107 \begin{lstlisting}
108 \ExplSyntaxOn
109 \let\PI\c_pi_fp
110 \ExplSyntaxOff
111 \end{lstlisting}
112
113 \subsection{Default setting}
114 \begin{lstlisting}
115 \documentclass{article}
116 \usepackage{xfakebold,xfp}
117 \begin{document}
118 An example:
119 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
120 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
121
122 \setBold\noindent
123 An example:
124 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
125 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
126
127 \unsetBold\noindent
128 An example:
129 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
130 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
131 \end{document}
132 \end{lstlisting}
133
134 \noindent
135 An example:
136 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
137 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
138
139 \setBold\noindent
140 An example:
141 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
142 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
143
144 \unsetBold\noindent
145 An example:
146 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
147 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
148
149
150 \section{Loading the package with another value}
151
152 \begin{lstlisting}
153 \documentclass{article}
154 \usepackage[bold=1]{xfakebold}
155 \usepackage{xfp}
156 \begin{document}
157 An example:
158 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
159 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
160
161 \setBold\noindent
162 An example:
163 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
164 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
165
166 \unsetBold\noindent
167 An example:
168 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
169 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
170 \end{document}
171 \end{lstlisting}
172
173 \noindent
174 An example:
175 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
176 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
177
178 \ifxetex\special{pdf:literal direct 2 Tr 1 w }%
179 \else\pdfrender{TextRenderingMode=FillStroke,LineWidth=1}\fi
180 \noindent
181 An example:
182 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
183 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
184
185 \ifxetex\special{pdf:literal direct 0 Tr 0 w }%
186 \else\pdfrender{TextRenderingMode=Fill,LineWidth=0}\fi
187 \noindent
188 An example:
189 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
190 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
191
192 \section{Using the optional argument of the macro}
193
194 \begin{lstlisting}
195 \documentclass{article}
196 \usepackage{xfakebold,xfp}
197 \begin{document}
198 \setBold[0.01]\noindent
199 An example:
200 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
201 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
202
203 \setBold[0.2]\noindent
204 An example:
205 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
206 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
207
208 \setBold[0.6]\noindent
209 An example:
210 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
211 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
212 \unsetBold
213
214 \setBold\noindent% Using the default value
215 An example:
216 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
217 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
218 \unsetBold
219 \end{document}
220 \end{lstlisting}
221
222 \setBold[0.01]\noindent
223 An example:
224 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
225 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
226
227 \setBold[0.2]\noindent
228 An example:
229 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
230 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
231
232 \setBold[0.6]\noindent
233 An example:
234 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
235 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
236 \unsetBold
237
238 \setBold\noindent% Using the default value
239 An example:
240 $\pi^{\pi}=\fpeval{\PI^\PI}$ and
241 $\displaystyle\int\limits_1^{\infty}\frac1{x^2}\symup dx=1$
242 \unsetBold
243 \end{document}