summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nodepthtext/nodepthtext.sty
blob: 83db274eb613e0f66143da816e36cf07b824d086 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
% Author        : C. Pierquet
% licence       : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nodepthtext}[2024/11/11 0.1.0 Raise small texts for "no depth" letters]

%====HISTORIQUE
% v 0.1.0	Initial version

%====BASE
\RequirePackage{xstring}
\RequirePackage{calc}
\RequirePackage{graphicx}

%====DIMs & Useful
\newlength\depthletter
\newlength\depthsampleletter
\newcount\cptraiseletter
\def\sampleslettersnodepth{azertuiosdhklmwxcvbnAZERTYUIOPSDFGHJKLMWXCVBN}

%====INT MACRO
\NewDocumentCommand\raiseletter{ O{0.8} m m }{%
	\settodepth{\depthletter}{\hbox{#3}}%
	\ifdim\depthletter>#2%
		\raisebox{\dimexpr#1\depthletter-#2\relax}{\resizebox{\width}{#1\height}{#3}}%
	\else%
		{#3}%
	\fi%
}

%====MAIN MACRO
\NewDocumentCommand\nodepth{ O{0.8} m }{%
	\settodepth{\depthsampleletter}{\hbox{\sampleslettersnodepth}}%
	\StrLen{#2}[\tmplenword]%
	\cptraiseletter0%
	\loop\ifnum\cptraiseletter<\tmplenword%
		\advance\cptraiseletter by 1%
		\raiseletter[#1]{\depthsampleletter}{\StrChar{#2}{\the\cptraiseletter}}%
	\repeat%
}

\endinput