summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/vectorlogos/tex/vectorlogos.sty
blob: e78247fee2ecf31c9b549e90f74f41c73e5d2c0e (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
% Author          : C. Pierquet
% licence         : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
% licenses svg    :
% python          : PSF license v2 https://www.python.org/community/logos/
% scratch         : Public https://commons.wikimedia.org/wiki/File:Scratchlogo.svg
% scratch alt     : Public https://commons.wikimedia.org/wiki/File:Scratchlogo.svg
% scratch cat     : CC40 https://fr.scratch-wiki.info/wiki/Fichier:Scratch_Cat_(cat-a).svg
% texstudio       : FREE https://en.m.wikipedia.org/wiki/File:TeXstudio_Logo.svg
% emacs logo      : FREE https://commons.wikimedia.org/wiki/File:EmacsIcon.svg
% emacs logo alt  : FREE https://fr.m.wikipedia.org/wiki/Fichier:Emacs-logo.svg
% geogebra icon   : CC30 https://fr.m.wikipedia.org/wiki/Fichier:Geogebra.svg
% geogebra logo   : CC30 https://fr.m.wikipedia.org/wiki/Fichier:Geogebra.svg
% texmaker        : FREE https://en.wikipedia.org/wiki/File:TeXmaker_Logo.svg
% texmaker old    : FREE https://en.wikipedia.org/wiki/File:TeXmaker_New_Logo.svg

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{vectorlogos}[2023/11/25 0.1.0 Vectorial logos of 'classic' softwares, for inline use.]

%====HISTORY
% v 0.1.0	Initial Version

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

%====LENGTHS
\newlength{\tmp@logosvg@total@height}
\newlength{\tmp@logosvg@depth}

%====MACRO CREATOR
\NewDocumentCommand\GenMacroLogoVect{ m m }{%1=macro,2=base,3=default
	\NewDocumentCommand#1{ O{} }{%
		\settototalheight{\tmp@logosvg@total@height}{\hbox{qB}}%
		\settodepth{\tmp@logosvg@depth}{\hbox{q}}%
		\IfFileExists{vectorlogo-#2-##1.pdf}%
			{%
				\raisebox{-\tmp@logosvg@depth+0.05\tmp@logosvg@total@height}{\includegraphics[height=0.9\tmp@logosvg@total@height]{vectorlogo-#2-##1.pdf}}%
			}%
			{%
				\raisebox{-\tmp@logosvg@depth+0.05\tmp@logosvg@total@height}{\includegraphics[height=0.9\tmp@logosvg@total@height]{vectorlogo-#2.pdf}}%
			}%
	}%
}

%====SIMPLE MACRO
\NewDocumentCommand\simplevectorlogo{ O{} m }{%
	\IfFileExists{vectorlogo-#2.pdf}%
		{%
			\includegraphics[#1]{vectorlogo-#2.pdf}%
		}%
		{}%
}

%====GENERIC MACROS
\NewDocumentCommand\vectorlogo{ O{logo} m }{%
	\IfEq{#2}{python}{\logopython[#1]}{}%
	\IfEq{#2}{scratch}{\logoscratch[#1]}{}%
	\IfEq{#2}{geogebra}{\logogeogebra[#1]}{}%
	\IfEq{#2}{texstudio}{\logotexstudio[#1]}{}%
	\IfEq{#2}{emacs}{\logoemacs[#1]}{}%
	\IfEq{#2}{texmaker}{\logotexmaker[#1]}{}%
}

%====SPECIFIC MACROS
\GenMacroLogoVect{\logopython}{python}
\GenMacroLogoVect{\logoscratch}{scratch}
\GenMacroLogoVect{\logogeogebra}{geogebra}
\GenMacroLogoVect{\logotexstudio}{texstudio}
\GenMacroLogoVect{\logoemacs}{emacs}
\GenMacroLogoVect{\logotexmaker}{texmaker}

\endinput