summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzmarmots/tikzmarmots-doc-settings.sty
blob: 9f7307dc8741b7250fa2fd7c30925f2b132353a7 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Personal helper theme for package documentations
% Copyright samcarter
%
% This file may be distributed and/or modified
% under the LaTeX Project Public License 1.3c or later
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Usage:
% ln ~/Life/latex/beamertheme-sam/themesam.sty package-doc-settings.sty 
% \usepackage[
%   themecolor=samdblue
% ]{\jobname-settings}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Colours
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{xcolor}
\definecolor{samyellow}{RGB}{246,193,65}
\definecolor{samorange}{RGB}{241,147,45}
\definecolor{samred}{RGB}{191,26,46}% TikZbricks
\definecolor{sammagenta}{RGB}{170,42,104}% TikZmarmots
\definecolor{samviolet}{RGB}{136,46,114}% TikZlings
\definecolor{samlila}{RGB}{101,67,159}% Rainbow beamer theme
\definecolor{samdblue}{RGB}{0,51,134}% beamer theme
\definecolor{samlblue}{RGB}{22,89,155}% TikZducks
\definecolor{samteal}{RGB}{25,143,157}% Tcolorbox beamer theme
\definecolor{samlgreen}{RGB}{68,170,153}% Jigsaw
\definecolor{samdgreen}{RGB}{78,178,125}
\definecolor{samlgray}{RGB}{160,160,185}
\definecolor{samdgray}{RGB}{60,60,85}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Package options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{xkeyval}
\DeclareOptionX{themecolor}[samdblue]{\colorlet{themecolor}{#1}}
\DeclareOptionX{listingcolor}[samlblue]{\colorlet{listingcolor}{#1}}
\ExecuteOptionsX{themecolor,listingcolor}
\ProcessOptionsX

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Packages
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\@ifclassloaded{beamer}{}{%
  \RequirePackage[english]{babel}
  \RequirePackage[paper=a4paper,margin=2.9cm]{geometry}
  \RequirePackage{scrlayer-scrpage}
  \let\hrulefillx\hrulefill
  \RequirePackage[bitstream-charter]{mathdesign}
  \let\hrulefill\hrulefillx
  \RequirePackage[hang,flushmargin,bottom]{footmisc}
  \RequirePackage[colorlinks=true,breaklinks=true,allcolors=themecolor]{hyperref}
}
\RequirePackage[T1]{fontenc}
\RequirePackage{xspace}
\RequirePackage{inconsolata}% mono font with bold, but italic is missing
% \RequirePackage[scale=0.85]{cascadia-code}
% \AddToHook{cmd/ttfamily/before}{\fontseries{sl}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Listings
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[
  cachedir=./build/
]{minted}

% smuggling custom pygmentize style in cache folder
% (a real pygmentise style would need installtion in some python folder)
\begin{filecontents*}[noheader]{./build/sam.pygstyle}
\makeatletter
\def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
    \let\PYG@ul=\relax \let\PYG@tc=\relax%
    \let\PYG@bc=\relax \let\PYG@ff=\relax}
\def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
\def\PYG@toks#1+{\ifx\relax#1\empty\else%
    \PYG@tok{#1}\expandafter\PYG@toks\fi}
\def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
    \PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}

% optional arguments
\expandafter\def\csname PYG@tok@na\endcsname{\def\PYG@tc##1{\textcolor{black}{##1}}}

% macros
\expandafter\def\csname PYG@tok@k\endcsname{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}
% curly brakets
\expandafter\def\csname PYG@tok@nb\endcsname{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}

% comments (italics won't work with the inconsolata font)
\expandafter\def\csname PYG@tok@c\endcsname{\def\PYG@tc##1{\textcolor{gray}{##1}}}

\def\PYGZbs{\char`\\}
\def\PYGZus{\char`\_}
\def\PYGZob{\char`\{}
\def\PYGZcb{\char`\}}
\def\PYGZca{\char`\^}
\def\PYGZam{\char`\&}
\def\PYGZlt{\char`\<}
\def\PYGZgt{\char`\>}
\def\PYGZsh{\char`\#}
\def\PYGZpc{\char`\%}
\def\PYGZdl{\char`\$}
\def\PYGZhy{\char`\-}
\def\PYGZsq{\char`\'}
\def\PYGZdq{\char`\"}
\def\PYGZti{\char`\~}
% for compatibility with earlier versions
\def\PYGZat{@}
\def\PYGZlb{[}
\def\PYGZrb{]}
\makeatother
\end{filecontents*}

\usemintedstyle{sam}
\setminted{
  breaksymbolleft={},
  tabsize=2,
  breaklines=true,
}
\newminted[samcode]{latex}{}
\newmintinline[saminline]{latex}{}

% use non-bold and all coloured for inline code in articles
\ifdefined\insertaspectratio\else
  \patchcmd{\minted@inputpyg@inline}{\minted@input}{\color{listingcolor}\renewcommand\textcolor[3][]{##3}\renewcommand\bfseries{}\minted@input}{}{}
\fi

\RequirePackage[most]{tcolorbox}
\tcbuselibrary{minted}
\tcbset{%
  colframe=themecolor,
  arc=2mm,
  fonttitle=\bfseries,
  sidebyside,
  center lower,
  righthand width=5.7cm,
  bottom=2pt, 
  top=2pt,
  sidebyside gap=10pt,
  lower separated=false,
  listing engine=minted,
  minted language=latex,
  colback=themecolor!10
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% document settings
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\@ifclassloaded{scrartcl}{%
  \addtokomafont{sectioning}{\color{themecolor}}
  \addtokomafont{date}{\normalsize}
  \addtokomafont{author}{\normalsize}
  \setlength{\footnotemargin}{0.7em}
}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Custom macros
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand*{\CTAN}{\textsc{CTAN}\xspace}
\providecommand*{\TikZ}{Ti\emph{k}Z\xspace}
\providecommand*{\miktex}{MiK\TeX\xspace}
\providecommand*{\texlive}{\TeX{}Live\xspace}
\providecommand*{\tikzbrick}{Ti\emph{k}Zbrick\xspace}
\providecommand*{\tikzducks}{Ti\emph{k}Zducks\xspace}
\providecommand*{\tikzlings}{Ti\emph{k}Zlings\xspace}
\providecommand*{\tikzmarmots}{Ti\emph{k}Zmarmots\xspace}
\providecommand*{\ConTeXt}{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt}