summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/customenvs/customenvs-doc-en.tex
blob: da20b128bc6174314c4b5280707867a694cdc8ec (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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
% !TeX TXS-program:compile = txs:///arara
% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode}
% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)')

\documentclass[english,11pt,a4paper]{article}
%\usepackage[utf8x]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage{DejaVuSerif}
%\usepackage[scale=1.1]{inconsolata}
\usepackage{customenvs}
\usepackage{xspace}
\usepackage{tabularx}
\usepackage{soul}
\usepackage{codehigh}
\usepackage{fontawesome5}
\usepackage{lipsum}
\usepackage{fancyvrb}
\usepackage{fancyhdr}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\lfoot{\sffamily\small [customenvs]}
\cfoot{\sffamily\small - \thepage{} -}
\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}}
\usepackage{hologo}
\providecommand\tikzlogo{Ti\textit{k}Z}
\providecommand\TeXLive{\TeX{}Live\xspace}
\providecommand\PSTricks{\textsf{PSTricks}\xspace}
\let\pstricks\PSTricks
\let\TikZ\tikzlogo

\usepackage{hyperref}
\urlstyle{same}
\hypersetup{pdfborder=0 0 0}
\usepackage[margin=1.5cm]{geometry}
\setlength{\parindent}{0pt}

\def\TPversion{0.1.1}
\def\TPdate{25/10/2023}
\usepackage{tcolorbox}
\sethlcolor{lightgray!25}
\NewDocumentCommand\MontreCode{ m }{%
	\hl{\vphantom{\texttt{pf}}\texttt{#1}}%
}

\usepackage{babel}

\begin{document}

\pagestyle{fancy}

\thispagestyle{empty}

\begin{center}
	\begin{minipage}{0.75\linewidth}
	\begin{tcolorbox}[colframe=yellow,colback=yellow!15]
		\begin{center}
			\renewcommand\arraystretch{1.25}
			\begin{tabular}{c}
				{\Huge \texttt{customenvs [en]}}\\
				\\
				{\Large Some custom environments,} \\
				{\Large with spacing enhancements.} \\
			\end{tabular}
			\renewcommand\arraystretch{1}
			
			\medskip
			
			{\small \texttt{Version \TPversion{} -- \TPdate}}
		\end{center}
	\end{tcolorbox}
\end{minipage}
\end{center}

\vspace*{1mm}

\begin{center}
	\begin{tabular}{c}
	\texttt{Cédric Pierquet}\\
	{\ttfamily c pierquet -- at -- outlook . fr}\\
	\texttt{\url{https://github.com/cpierquet/customenvs}}
\end{tabular}
\end{center}

\vspace*{5mm}

%\hrule
%
%\vspace*{2mm}
%
%{\centering Le nom du package vient de \textsf{ENVironnemenTS ALTernatifs}, avec le suffixe \textsf{FRançais}.\par}
%
%\vspace*{2mm}
%
%\hrule
%
%\vspace*{1cm}

\hrule

\phantomsection

\hypertarget{matoc}{}

\tableofcontents

\vspace*{5mm}

\hrule

\vfill

\section{History}

\verb|v0.1.1|~:~~~~Skills table (only french for the moment...)

\verb|v0.1.0|~:~~~~Initial version

\vspace*{5mm}

\pagebreak

\section{The package customenvs}

\subsection{Idea}

The idea is to propose some classics environments with customizations (some are, for the moment, only in french) :

\begin{itemize}
	\item write in \textit{multicols}, with spacings enhancements ;
	\item present answers for a \textit{MCQ} ;
	\item create a list with \textit{choosen items} (randomly or by numbers) ;
	\item present a skill table.
\end{itemize}

\smallskip

The globa idea is ti propose \textit{user-friendly} environments, with explicit customizations, without using verbose syntax ; but there's other solutions, using for example \MontreCode{\textbackslash vspace} ou \MontreCode{\textbackslash  setlength} or \MontreCode{spacingtricks} package.

\subsection{Loading}

The package loads within the preamble with \MontreCode{\textbackslash usepackage\{customenvs\}}.

Loaded packages are 

\begin{itemize}
	\item \MontreCode{xstring}, \MontreCode{simplekv}, \MontreCode{listofitems}, \MontreCode{randomlist} and \MontreCode{xintexpr} ;
	\item \MontreCode{enumitem} ;
	\item \MontreCode{multicol} ;
	\item \MontreCode{tabularray} ;
	\item \MontreCode{fontawesome5} ;
\end{itemize}

Due to limitations, \MontreCode{enumitem}/\MontreCode{multicol}/\MontreCode{tabularray}\MontreCode{fontawesome5} can be \textit{un}loaded by \MontreCode{customenvs} (user must load them manually) via options :

\begin{itemize}
	\item \MontreCode{$\mathtt{\langle}$noenum$\mathtt{\rangle}$} ;
	\item \MontreCode{$\mathtt{\langle}$nomulticol$\mathtt{\rangle}$} ;
	\item \MontreCode{$\mathtt{\langle}$notblr$\mathtt{\rangle}$} ;
	\item \MontreCode{$\mathtt{\langle}$nofa$\mathtt{\rangle}$} ;
\end{itemize}

\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
%with all packages
\usepackage{customenvs}

%with option to no load some packages
\usepackage[option(s)]{customenvs}
\end{codehigh}

\newpage

\section{Answers for a MCQ}

\subsection{Idea}

The idea is to propose an environment to present answers for a MQC with \MontreCode{tabularray} (and not \MontreCode{multicols}).

\smallskip

It's possible to use 2, 3 or 4 answers (and with 4 answers it's possible to use 2 columns.)

\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[options]{list of answers}<tblr options>
\end{codehigh}

The avalailable \MontreCode{options} are :

\begin{itemize}
	\item \MontreCode{Width} : \MontreCode{0.99\textbackslash linewidth} by default ;
	\item \MontreCode{Lines}  : \MontreCode{false} by default ;
	\item \MontreCode{SpaceCR} for Columns/Rows spacing, within \MontreCode{col/row} or \MontreCode{global} : \MontreCode{6pt/2pt} by default ;
	\item \MontreCode{NumCols}, 2 or 4 : \MontreCode{4} by default ;
	\item \MontreCode{Labels} for the labels : \MontreCode{a.} by default ;
	\begin{itemize}
		\item with \MontreCode{a} to \textit{enumerate} \MontreCode{a b c d} ;
		\item with \MontreCode{A} to \textit{enumerate} \MontreCode{A B C D} ;
		\item with \MontreCode{1} to \textit{enumerate} \MontreCode{1 2 3 4} ;
	\end{itemize}
	\item \MontreCode{FontLabels} : \MontreCode{\textbackslash bfseries} by default ;
	\item \MontreCode{SpaceLabels} : \MontreCode{\textbackslash kern5pt} by default ;
	\item \MontreCode{Swap}, for ACBD instead of ABCD : \MontreCode{false} by default.
\end{itemize}

The list of answers must be given within \MontreCode{answA § answB § ...}.

Specific options for \MontreCode{tblr} are given between last optionnal argument, between \MontreCode{<...>}.

\subsection{Examples}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
%default output
\AnswersMCQ{Answer A § Answer B § Answer C § Answer D}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[Lines]{Answer A § Answer B § Answer C § Answer D}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[Lines,Labels=(1.),SpaceLabels={~~~}]{Answer A § Answer B § Answer C}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[Labels={A.},FontLabels={\color{red}\bfseries}]%
    {Answer A § Answer B § Answer C § Answer D}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[Labels={1.},FontLabels={\color{red}\bfseries}]%
    {Answer A § Answer B § Answer C § Answer D}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[NumCols=2,Labels={A.},FontLabels={\color{red}\bfseries}]%
    {Answer A § Answer B § Answer C § Answer D}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[NumCols=2,Swap,Labels={A.},FontLabels={\color{red}\bfseries}]%
    {Answer A § Answer B § Answer C § Answer D}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[Lines,NumCols=2,SpaceCR=6pt/10pt]%
    {Answer A § Answer B § Answer C § Answer D}
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\AnswersMCQ[Width=10cm,NumCols=2,Lines]%
    {$\displaystyle\frac1x$ § $1+\displaystyle\frac1x$ § $-2x^2+5$ § $-\infty$}
    <rows={1.5cm}>
\end{demohigh}

\pagebreak

\section{List avec with picked elements (random or not)}

\subsection{Global use}

The idea is to :

\begin{itemize}
	\item create a list of items, the base for choices ;
	\item print the list with picked items.
\end{itemize}

\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\CreateItemsList{list}{macro}{listname}
\end{codehigh}

\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
\ListItemsChoice[keys]{macro}{listname}(numbers)<enumitem options>
\end{codehigh}

The available \MontreCode{keys} are :

\begin{itemize}
	\item \MontreCode{Type} : \MontreCode{enum} or \MontreCode{item} ;
	\item \MontreCode{Random}  : \MontreCode{false} by default.
\end{itemize}

The second argument, mandatory and between \MontreCode{\{...\}} is the macro for the list.

The third argument, mandatory and between \MontreCode{\{...\}} is the name of the list.

The fourth argument, mandatory and between \MontreCode{(...)} give :

\begin{itemize}
	\item the number of random items to display, with \MontreCode{Random=true} ;
	\item the numbers of picked itemps, within \MontreCode{num1,num2,...}.
\end{itemize}


The last argument, optional and between \MontreCode{<...>} gives specific options to \MontreCode{enumitem} environment.

\medskip

Controls are done :

\begin{itemize}
	\item to verify that the liste doesn't exist (for the creation) ;
	\item to verify that that the list still exist (for the display).
\end{itemize}

\subsection{Examples}

\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
%creation of list ListItems, with macro \mylistofitems
\CreateItemsList%
    {Answer A,Answer B,Answer C,Answer D,Answer E,Answer F,Answer G,Answer H}%
    {\mylistofitems}{ListItems}
\end{codehigh}

\CreateItemsList%
{Answer A,Answer B,Answer C,Answer D,Answer E,Answer F,Answer G,Answer H}%
{\mylistofitems}{ListItems}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
%items random
\ListItemsChoice[Random]{\mylistofitems}{ListItems}(5)
\end{demohigh}

\begin{demohigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
%items picked 
\ListItemsChoice{\mylistofitems}{ListItems}(1,4,3,8,2)
\end{demohigh}

\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
%creation of list ListItemsB, with macro \mylistofitemsb
\CreateItemsList%
    {{$\int_0^1 x^2 dx$},{$\int_0^1 x^3 dx$},{$\int_0^1 x^4 dx$},...}%
    {\mylistofitemsb}{ListItemsB}
\end{codehigh}

\CreateItemsList%
{{$\int_0^1 x^2 dx$},{$\int_0^1 x^3 dx$},{$\int_0^1 x^4 dx$},{$\int_0^1 x^5 dx$},{$\int_0^1 x^6 dx$},{$\int_0^1 x^7 dx$},{$\int_0^1 x^8 dx$}}%
{\mylistofitemsb}{ListItemsB}

\begin{codehigh}[language=latex/latex3,style/main=teal!25,style/code=teal!25]
%items picked 
\ListItemsChoice[Type=item]{\mylistofitemsb}{ListItemsB}(7,2,1,5,3)<label=$--$>
\end{codehigh}

\ListItemsChoice[Type=item]{\mylistofitemsb}{ListItemsB}(7,2,1,5,3)<label=$--$>

\end{document}