Debian Codegraph @

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

raw
1 % !TeX TXS-program:compile = txs:///arara
2 % arara: pdflatex: {shell: no, synctex: no, interaction: batchmode}
3 % arara: pdflatex: {shell: no, synctex: no, interaction: batchmode}
4
5 \documentclass[11pt,a4paper]{ltxdoc}
6 \usepackage[T1]{fontenc}
7 \usepackage[utf8]{inputenc}
8 \usepackage{nodepthtext}
9 \usepackage{fancyvrb}
10 \usepackage{fancyhdr}
11 \usepackage{tabularray}
12 \usepackage{fontawesome5}
13 \fancyhf{}
14 \renewcommand{\headrulewidth}{0pt}
15 \lfoot{\sffamily\small [nodepthtext-doc]}
16 \cfoot{\sffamily\small - \thepage{} -}
17 \rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}}
18 \usepackage{hologo}
19 \providecommand\tikzlogo{Ti\textit{k}Z}
20 \providecommand\TeXLive{\TeX{}Live\xspace}
21 \let\TikZ\tikzlogo
22
23 \newcommand\fontIZ{\fontencoding{T1}\fontfamily{zi4}\fontseries{sb}\selectfont}
24
25 \usepackage{hyperref}
26 \urlstyle{same}
27 \hypersetup{pdfborder=0 0 0}
28 \usepackage[margin=2cm]{geometry}
29 \setlength{\parindent}{0pt}
30 \def\TPversion{0.1.0}
31 \def\TPdate{11/11/2024}
32 \usepackage{tcolorbox}
33 \usepackage{pgffor}
34 \tcbuselibrary{breakable,skins,hooks,listingsutf8}
35
36 \lstdefinestyle{packagestyle}
37 {
38 language=[LaTeX]TeX,%
39 columns=fullflexible,%
40 extendedchars=true,%
41 basicstyle=\small\ttfamily,%
42 keywordstyle={\color{black}},%
43 classoffset=0,%
44 keywords={},%
45 alsoletter={-},%
46 keywordstyle={\color{blue}},%
47 classoffset=1,%
48 alsoletter={-},%
49 morekeywords={nodepthtext,calc,xstring,graphicx,inputenc,fontenc},%
50 keywordstyle={\color{violet}},%
51 classoffset=2,%
52 alsoletter={-},%
53 morekeywords={\nodepth},%
54 keywordstyle={\color{green!50!black}},%
55 classoffset=3,%
56 morekeywords={scale,strut},%
57 keywordstyle={\color{orange}},%
58 inputencoding=utf8/latin1
59 }
60
61 \lstset{
62 % language=[LaTeX]TeX,%
63 basicstyle=\small\ttfamily,%
64 keywordstyle={},%
65 }
66
67 \newtcblisting{DemoCode}[1]{%
68 enhanced,width=\linewidth,%
69 bicolor,size=title,%
70 colback=cyan!10!white,%
71 colbacklower=cyan!5!white,%
72 colframe=cyan!75!black,%
73 listing options={%
74 breaklines=true,%
75 breakatwhitespace=true,%
76 style=packagestyle,%
77 basicstyle=\footnotesize\ttfamily,%
78 tabsize=4,%
79 commentstyle={\itshape\color{gray}},
80 keywordstyle={\color{blue}},%
81 classoffset=0,%
82 keywords={},%
83 alsoletter={-},%
84 keywordstyle={\color{blue}},%
85 classoffset=1,%
86 alsoletter={-},%
87 morekeywords={nodepthtext,calc,xstring,graphicx,inputenc,fontenc},%
88 keywordstyle={\color{violet}},%
89 classoffset=2,%
90 alsoletter={-},%
91 morekeywords={\nodepth},%
92 keywordstyle={\color{green!50!black}},%
93 classoffset=3,%
94 morekeywords={scale,strut},%
95 keywordstyle={\color{orange}}
96 },%
97 #1
98 }
99
100 \newtcbinputlisting\DemoCodeFile[1]{%
101 enhanced,width=\linewidth,%
102 bicolor,size=title,%
103 colback=lightgray!10!white,%
104 colbacklower=lightgray!5!white,%
105 colframe=lightgray!75!black,%
106 listing options={%
107 breaklines=true,%
108 breakatwhitespace=true,%
109 style=tcblatex,
110 extendedchars=true,%
111 basicstyle=\tiny\ttfamily,%
112 keywordstyle={},%
113 tabsize=2,%
114 commentstyle={\itshape\color{gray}},%
115 inputencoding=utf8/latin1
116 },%
117 breakable,
118 listing only,%
119 listing file={#1}
120 }
121
122 \NewDocumentCommand\ShowCode{ m }{%
123 \colorbox{lightgray!50}{\lstinline!#1!}%
124 }
125
126 \begin{document}
127
128 \thispagestyle{empty}
129
130 \begin{center}
131 \begin{minipage}{0.88\linewidth}
132 \begin{tcolorbox}[colframe=yellow,colback=yellow!15]
133 \begin{center}
134 \renewcommand{\arraystretch}{1.25}%
135 \begin{tabular}{c}
136 {\Huge \texttt{nodepthtext}}\\
137 \\
138 {\LARGE Adapt small texts,} \\
139 {\LARGE with empty depth.} \\
140 \\
141 {\small \texttt{Version \TPversion{} -- \TPdate}}
142 \end{tabular}
143 \end{center}
144 \end{tcolorbox}
145 \end{minipage}
146 \end{center}
147
148 \begin{center}
149 \begin{tabular}{c}
150 \texttt{Cédric Pierquet}\\
151 {\ttfamily c pierquet -- at -- outlook . fr}\\
152 \texttt{\url{https://github.com/cpierquet/nodepthtext}} \\
153 \end{tabular}
154 \end{center}
155
156 \hrule
157
158 \vfill
159
160 \begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
161 %normal version, with depth of letters & nodepth version, with removing depth and resizing
162 A sample text to show letters with depth.\\
163 \nodepth{A sample text to show letters without depth.}
164 \end{tcolorbox}
165
166 \begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
167 %normal version, with depth of letters & nodepth version, with removing depth and resizing
168 {\LARGE\ttfamily A text to show letters with depth.}\\
169 {\LARGE\ttfamily\nodepth{A text to show letters without depth.}}\\
170 {\LARGE\ttfamily\nodepth[0.7]{A text to show letters without depth and rescaling.}}
171 \end{tcolorbox}
172
173 \begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
174 %normal version, with depth of letters & nodepth version, with removing depth and resizing
175 {\LARGE\fontIZ A text to show letters with depth (inconsolata).}\\
176 {\LARGE\fontIZ\nodepth{A text to show letters w/o depth (inconsolata).}}\\
177 {\LARGE\fontIZ\nodepth[0.7]{A text w/o depth and scaling (inconsolata).}}
178 \end{tcolorbox}
179
180 \vfill~
181
182 \vspace*{5mm}
183
184 \pagebreak
185
186 \phantomsection
187
188 \hypertarget{matoc}{}
189
190 \tableofcontents
191
192 \vspace*{5mm}
193
194 %\hrule
195
196 \pagebreak
197
198 \section{Introduction}
199
200 \subsection{Loading, useful packages}
201
202 In order to load \ShowCode{nodepthtext}, simply use:
203
204 \begin{DemoCode}{listing only}
205 \usepackage{nodepthtext}
206 \end{DemoCode}
207
208 Loaded packages are \ShowCode{graphicx}, \ShowCode{xstring} and \ShowCode{calc}.
209
210 \subsection{Usage, limitations}
211
212 The purpose of this package is to provide command, based on \ShowCode{\\raisebox} and \ShowCode{\\resizebox}, to locally remove depth of characters.
213
214 \begin{itemize}
215 \item the code read characters one by one;
216 \item whenever a character (letter or punctuation\ldots) with depth is processed, this character is raised and resized in order to match others characters;
217 \item if \hologo{LuaLaTeX} is used, accentuated characters can be given normally (\texttt{uft8}), but with \hologo{pdfLaTeX}, they mus be given within \LaTeX\ syntax.
218 \end{itemize}
219
220 So, for accentuated letters (because \ShowCode{xstring} processes the characters), please load \ShowCode{inputenc} and \ShowCode{fontenc} with corrects options if \hologo{pdfLaTeX} is used (not necessary with \hologo{LuaLaTeX}).
221
222 \begin{DemoCode}{listing only}
223 %example with pdflatex preamble
224 \usepackage[T1]{fontenc}
225 \usepackage[utf8]{inputenc}
226 \end{DemoCode}
227
228 \vfill
229
230 \subsection{History}
231
232 \texttt{0.1.0: Initial version}
233
234 \vspace*{5mm}
235
236 \pagebreak
237
238 \section{The macro}
239
240 The main macro is \ShowCode{\\nodepth}.
241
242 \begin{DemoCode}{listing only}
243 \nodepth[scale]{text}
244 \end{DemoCode}
245
246 The optional argument, within \ShowCode{[...]}, can modify scale for modified characters (\ShowCode{0.8} by default).
247
248 The mandatory argument, within \ShowCode{\{...\}}, is a small text to process (beware of accentuated characters).
249
250 \smallskip
251
252 In order to work with sizes and fonts, the macro needs to be given within the group of defined size/font!
253
254 \section{Samples}
255
256 \subsection{Wih custom size}
257
258 \begin{DemoCode}{}
259 %normal version, with depth of letters
260 {\LARGE\ttfamily A text to show letters with depth.}
261
262 %nodepth version, with removing depth and resizing
263 {\LARGE\ttfamily\nodepth{A text to show letters without depth.}}\\
264 {\LARGE\ttfamily\nodepth[0.7]{A text to show letters without depth and scaling.}}
265 \end{DemoCode}
266
267 \subsection{With custom font, and accents}
268
269 \begin{DemoCode}{listing only}
270 %use inconsolata font (with pdfLaTeX)
271 \newcommand\fontIZ{\fontencoding{T1}\fontfamily{zi4}\fontseries{sb}\selectfont}
272 \end{DemoCode}
273
274 \begin{DemoCode}{}
275 %normal version, with depth of letters and accents (inconsolata font)
276 {\large\fontIZ A text to show depth and a word with accents, météo.}\\
277
278 %nodepth version, with removing depth and resizing and accents...
279 {\large\fontIZ\nodepth{Quote text w/o depth and a word with accents, m\'{e}t\'{e}o.}}\\
280 {\large\fontIZ\nodepth[0.7]{Quote text w/o depth, scaling and a word with accents, m\'{e}t\'{e}o.}}
281 \end{DemoCode}
282
283 \pagebreak
284
285 \section{The code}
286
287 \DemoCodeFile{nodepthtext.sty}
288
289 \end{document}