summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/writeongrid/doc/WriteOnGrid-doc-en.tex
blob: e03e735fa8b6fcf94f31c9ffc9b824e59619b8ab (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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
% !TeX TXS-program:compile = txs:///arara
% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode}
% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)')

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{WriteOnGrid}
\usetikzlibrary{decorations.pathreplacing}
\usepackage{amsmath,amssymb}
\usepackage{fontawesome5}
\usepackage{enumitem}
\usepackage{frcursive}
\usepackage{lipsum}
\usepackage{tabularray}
\usepackage{fancyvrb}
\usepackage{fancyhdr}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\lfoot{\sffamily\small [WriteOnGrid]}
\cfoot{\sffamily\small - \thepage{} -}
\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}}

\usepackage{hologo}
\usepackage{xspace}
\newcommand\tikzlogo{Ti\textit{k}Z}
\newcommand\TeXLive{\hologo{TeX}Live\xspace}
\let\TikZ\tikzlogo
\newcommand\TableauDocumentation{%
	\begin{tblr}{width=\linewidth,colspec={X[c]X[c]X[c]X[c]X[c]X[c]},cells={font=\sffamily}}
		{\huge \LaTeX} & & & & &\\
		& {\huge \hologo{pdfLaTeX}} & & & & \\
		& & {\huge \hologo{LuaLaTeX}} & & & \\
		& & & {\huge \TikZ} & & \\
		& & & & {\huge \TeXLive} & \\
		& & & & & {\huge \hologo{MiKTeX}} \\
	\end{tblr}
}

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

\def\TPversion{0.1.1}
\def\TPdate{20/01/2023}

\usepackage[most]{tcolorbox}
\tcbuselibrary{minted}
\NewTCBListing{PresentationCode}{ O{blue} m }{%
	sharp corners=downhill,enhanced,arc=12pt,skin=bicolor,%
	colback=#1!1!white,colframe=#1!75!black,colbacklower=white,%
	attach boxed title to top right={yshift=-\tcboxedtitleheight},title=Code \LaTeX,%
	boxed title style={%
		colframe=#1!75!black,colback=#1!15!white,%
		,sharp corners=downhill,arc=12pt,%
	},%
	fonttitle=\color{#1!90!black}\itshape\ttfamily\footnotesize,%
	listing engine=minted,minted style=colorful,
	minted language=tex,minted options={tabsize=4,fontsize=\footnotesize,autogobble},
	#2
}

\newcommand\Cle[1]{{\bfseries\sffamily\textlangle #1\textrangle}}

\begin{document}

\pagestyle{fancy}

\thispagestyle{empty}

\vspace{2cm}

\begin{center}
	\begin{minipage}{0.75\linewidth}
	\begin{tcolorbox}[colframe=yellow,colback=yellow!15]
		\begin{center}
			\begin{tabular}{c}
				{\Huge \texttt{WriteOnGrid [en]}}\\
				\\
				{\LARGE To write on lines} \\
				{\LARGE of a grid.}
			\end{tabular}
			
			\medskip
			
			{\small \texttt{Version \TPversion{} -- \TPdate}}
		\end{center}
	\end{tcolorbox}
\end{minipage}
\end{center}

\vspace{0.5cm}

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

\vspace{0.5cm}

{$\blacktriangleright$~~Some commands to create a grid (5x5 or Seyes or Ruled) and to write "on" the lines.}

\smallskip

{$\blacktriangleright$~~Possibility to personnalize size, margins, ...}

\vspace{1cm}

\begin{center}
	\begin{EnvGrid}[NumSquares=22x8]
	\WriteLine{my text on line 1\ldots}
	\WriteLine<center>{my centered text on line 2\ldots}
	\WriteLine<right>{my right-align text on ligne 3\ldots}
	\WriteLine[OffsetH=2]{my 2-squares shifted text on line 4\ldots}
	\PassLine
	\WriteLine{\sffamily my text, sans serif, on line 6\ldots}
	\WriteLine[OffsetH=-1]{\small\cursive my -1-square shifted text on line 7\ldots}
\end{EnvGrid}
\end{center}

\begin{EnvGrid}[NumSquares=24x5,Margin=1,Enlarge=2/2,Grid=Seyes]<Plum!75/LightSteelBlue!50>
	\WriteLine[Scale=1.5]{\textcolor{red}{my text on line 1\ldots}}
	\WriteLine[Scale=1.5]{\textcolor{blue}{my text on line 2\ldots}}
	\WriteLine[Scale=1.5,OffsetH=-1]{$1+\frac{1}{2}=\frac32$ et $(1+x)^2=1+2x+x^2$ on line 3\ldots}
	\WriteLine[Scale=1.5]{\cursive my text on line 4\ldots}
\end{EnvGrid}

\vspace{0.5cm}

\hfill{}\textit{Thanks to Patrick Bideault for ideas and help !}

\vfill

\hrule

\medskip

\TableauDocumentation

\medskip

\hrule

\medskip

\newpage

\part*{Usage}

\section{The package}

\subsection{Loading of the package, used packages}

The package \textsf{WriteOnGrid} loads within the preamble :

\begin{PresentationCode}{listing only}
\usepackage{WriteOnGrid}
\end{PresentationCode}

It’s mostly compatible with \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} or \textsf{xelatex} compilation !

\medskip

It loads the following packages and libraries :

\begin{itemize}
	\item \texttt{xcolor} with options \Cle{table,svgnames} ;
	\item \texttt{tikz} with the librairies \Cle{calc} and \Cle{positionning} ;
	\item \texttt{xstring}, \texttt{xparse} and \texttt{simplekv}.
\end{itemize}

\subsection{The package itself}

The idea is to, thanks to \TikZ, propose commands and environment to work with a grid, and to write on the lines.

\begin{PresentationCode}{listing only}
%environment, with keys to prepare the grid
%commands to write or pass a line

\begin{EnvGrid}[keys]<color>
	\WriteLine[keys]<alignment>{text}
	\PassLine
\end{EnvGrid}
\end{PresentationCode}

\subsection{Overall functioning}

The grid is given by the number of squares (nbCol$\times$nbRow), and after we can adjust with \textit{overtakings} to enlarge the grid onto the margins of the paper (left or right). We can also \textit{adjust} the global margin, to begin the lines differently.

\medskip

For example, a $5\times5$ grid :

\begin{itemize}
	\item with a size 24x5 squares ;
	\item with an overtaking by \textcolor{red}{2 squares at the left} and \textcolor{blue}{3 squares at the right} ;
	\item with a global margin of \textcolor{orange}{1 square} ;
	\item with a \textcolor{ForestGreen}{\textit{border}} to show the \textit{basis} grid.
\end{itemize}

\medskip

\begin{tikzpicture}
	\useasboundingbox (0,0) rectangle ({0.5*24},{-0.5*5}) ;
	\draw[xstep=0.5,ystep=0.5,thin,lightgray!75] ({-0.5*2},0) grid ({0.5*24+0.5*3},{-0.5*5}) ;
	\draw[thick,decorate,decoration={brace,amplitude=8pt,mirror}](0,{-0.5*5-0.25})--({0.5*24},{-0.5*5-0.25}) node[midway,below=8pt,font=\small\sffamily] {24C} ;
	\draw[red,thick,decorate,decoration={brace,amplitude=8pt,mirror}] ({-2*0.5},{-0.5*5-0.25})--({0},{-0.5*5-0.25}) node[midway,below=8pt,font=\small\sffamily] {2C} ;
	\draw[blue,thick,decorate,decoration={brace,amplitude=8pt,mirror}] ({0.5*24},{-0.5*5-0.25})--({0.5*24+3*0.5},{-0.5*5-0.25}) node[midway,below=8pt,font=\small\sffamily] {3C} ;
	\draw[thick,decorate,decoration={brace,amplitude=8pt}] ({0.5*24+3*0.5+0.25},0)--({0.5*24+3*0.5+0.25},{-0.5*5}) node[midway,right=8pt,font=\small\sffamily] {5C} ;
	\draw[very thick,orange,densely dashed] ({0.5*1},0)--({0.5*1},{-0.5*5}) ;
	\draw[ForestGreen,thick] (0,0) rectangle ({0.5*24},{-0.5*5}) ;
\end{tikzpicture}

\vspace{1.5cm}

The \texttt{tikzpicture} is \textit{bounded} by the \textcolor{ForestGreen}{\textit{border}}, in order to specify overtakings or alignment.

\medskip

Le left-border of the \textcolor{ForestGreen}{\textit{border}} is aligned on the left-margin of the page, so take care of the \texttt{\textbackslash parindent}.

\pagebreak

\section{Commands, keys and options}

\subsection{The environement}

\begin{PresentationCode}{listing only}
%environment, with keys to prepare the grid

\begin{EnvGrid}[keys]<color>
	...
\end{EnvGrid}
\end{PresentationCode}

The first argument, \textit{optional}, between \texttt{[...]} give the \Cle{keys} :

\begin{itemize}
	\item \Cle{NumSquares} to specify the size of the grid, under \texttt{(nbCol)x(nbRow)} ; \hfill~default : \Cle{17x5}
	\item \Cle{Unit} to specify the scale of the grid ; \hfill~default : \Cle{1}
	\item \Cle{Margin} to specify the global \textcolor{orange}{margin} at the beginning of the lines ; \hfill~default : \Cle{0}
	\item \Cle{Enlarge} to specify the squares-overtakings, globally with \texttt{\textcolor{red}{L}\textcolor{blue}{R}} or side by side with \texttt{\textcolor{red}{L}/\textcolor{blue}{R}} ;\hfill~default : \Cle{0}
	\item the boolean \Cle{Border} to display the basis border of the grid ;\hfill~default : \Cle{false}
	\item the key\Cle{Grille}, from \Cle{5x5/Seyes/Ruled}, to specify the grid's type.\hfill~défaut : \Cle{5x5}
\end{itemize}

The second argument, \textit{optional}, between \texttt{<...>} is the color(s) of the grid :

\begin{itemize}
	\item by \Cle{Color} (\Cle{lightgray!50} by default) for $5\times5$ or Ruled ;
	\item by \Cle{ColorA/ColorB} (\Cle{lightgray!50/lightgray!25} by default) for Seyes.
\end{itemize}

\medskip

\begin{PresentationCode}{listing only}
%18x4 big squares, w/o overtaking, 3-margin
\begin{EnvGrid}[NumSquares=18x4,Grid=Seyes,Margin=3]<Plum!75/LightSteelBlue!50>
\end{EnvGrid}

%36x8 small squares, overtakings 3/3, LightSteelBlue color
\begin{EnvGrid}[NumSquares=36x8,Enlarge=3/3]<LightSteelBlue>
\end{EnvGrid}

%12x3 lines "Ruled", w/o overtakins, orange!50 color, centered, with 2-margin
\begin{center}
	\begin{EnvGrid}[NumSquares=12x3,Grid=Ruled,Margin=2]<orange!50>
	\end{EnvGrid}
\end{center}
\end{PresentationCode}

\medskip

\begin{EnvGrid}[NumSquares=18x4,Grid=Seyes,Margin=3]<Plum!75/LightSteelBlue!50>
\end{EnvGrid}

\smallskip

\begin{EnvGrid}[NumSquares=36x8,Enlarge=3/3]<LightSteelBlue>
\end{EnvGrid}

\smallskip

\begin{center}
	\begin{EnvGrid}[NumSquares=12x3,Grid=Ruled,Margin=2]<orange!50>
	\end{EnvGrid}
\end{center}

\pagebreak

\subsection{Write on the lines}

The idea is to write on the created grid. In order to write \textit{right} on the lines, we can :

\begin{itemize}
	\item give the lines one by one ;
	\item avoid using multilines paragraps, items ;
	\item pass a line.
\end{itemize}

\begin{PresentationCode}{listing only}
...
	%to write the lines, one by one
	\WriteLine[keys]<alignment>{text}
	%to pass the ligne
	\PassLine
...
\end{PresentationCode}

The fisrt argument, \textit{optional}, between \texttt{[...]} give the \Cle{keys} :

\begin{itemize}
	\item \Cle{OffsetH}, in squares, to shift the text from the \textcolor{orange}{margin} ; \hfill~default : \Cle{0}
	\item \Cle{OffsetV} to shift vertically the line ; \hfill~default : \Cle{0pt}
	\item \Cle{Scale} to specify the scale of the given text.\hfill~default : \Cle{1}
\end{itemize}

the second argument, \textit{optional}, between \texttt{<...>} is the horizontal alignment (\Cle{left/center/right}) of the text in the basis \textcolor{ForestGreen}{\textit{border}}, \Cle{left} by default.

\medskip

Le third argument, \textit{mandatory} and between \texttt{\{...\}} is the text, eventually with options.

\begin{PresentationCode}{listing only}
\begin{EnvGrid}[NumSquares=36x8]
	\WriteLine[Scale=1.5]{my text on ligne 1\ldots}
	\WriteLine[Scale=1.5]<center>{\ttfamily my tetetype text centered on line 2\ldots}
	\WriteLine[Scale=1.5]<right>{right-align text on line 3\ldots}
	\WriteLine[Scale=1.5,OffsetH=0.1]{\textcolor{red}{red text, 1mm-shifted\ldots}}
	\PassLine
	\WriteLine[Scale=0.5]{\sffamily sans serif text, reduced by 50\,\%, on line 6\ldots}
	\WriteLine[Scale=1.5,OffsetH=3]{\cursive 3 squares-shifted text\ldots}
\end{EnvGrid}
\end{PresentationCode}

\begin{EnvGrid}[NumSquares=36x8]
	\WriteLine[Scale=1.5]{my text on ligne 1\ldots}
	\WriteLine[Scale=1.5]<center>{\ttfamily my tetetype text centered on line 2\ldots}
	\WriteLine[Scale=1.5]<right>{right-align text on line 3\ldots}
	\WriteLine[Scale=1.5,OffsetH=0.1]{\textcolor{red}{red text, 1mm-shifted\ldots}}
	\PassLine
	\WriteLine[Scale=0.5]{\sffamily sans serif text, reduced by 50\,\%, on line 6\ldots}
	\WriteLine[Scale=1.5,OffsetH=3]{\cursive 3 squares-shifted text\ldots}
\end{EnvGrid}

\begin{PresentationCode}{listing only}
\begin{EnvGrid}[NumSquares=16x4,Margin=2,Grid=Ruled]
	\WriteLine[Scale=1.5]{\textcolor{red}{red text on line 1\ldots}}
	\WriteLine[Scale=1.15,OffsetH=1]{$(1+x)^2=1+2x+x^2$ on line 2, with 1-square offset\ldots}
	\WriteLine[OffsetH=-1]{\textcolor{blue}{blue text, back to left, on line 3\ldots}}
\end{EnvGrid}

\end{PresentationCode}
\begin{EnvGrid}[NumSquares=16x4,Margin=2,Grid=Ruled]
	\WriteLine[Scale=1.5]{\textcolor{red}{red text on line 1\ldots}}
	\WriteLine[Scale=1.15,OffsetH=1]{$(1+x)^2=1+2x+x^2$ on line 2, with 1-square offset\ldots}
	\WriteLine[OffsetH=-1]{\textcolor{blue}{blue text, back to left, on line 3\ldots}}
\end{EnvGrid}

\newpage

\part*{Additional informations}

\section{Introduction}

There's few other possibilities with the package\textsf{WorkOnGrid}, but for the moment only with \textit{french} keys, so there's no specific documentation for these commands.

\smallskip

To sum up, they create full paper grid, with the ability to write paragraph.

\section{Example}

\begin{PresentationCode}{listing only}
\begin{PleinePageRuled}[NumLignes]
	\LignePapierRuled[Echelle=1.25,Ligne=1]{C. PIERQUET \hfill LaTeX}
	\LignePapierRuled[Echelle=1.25,Ligne=2,Couleur=red]<center>{\underline{\cursive\bfseries Evaluation 3}}
	\CadreNoteRuled{3}
	\LignePapierRuled[Echelle=1.25,Ligne=8,Couleur=ForestGreen]{\sffamily\underline{Exercise 1 :}}
	\ParagraphePapierRuled[Ligne=9]{\cursive\lipsum[1]}
	\ParagraphePapierRuled[Ligne=22]
	{%
		We try with math, $1+\frac12=\frac32$, inline, with several lines.\\
		And another math example, $\int_0^1 2x dx = 1$.\\
		A new line now !
	}
\end{PleinePageRuled}
\end{PresentationCode}

\pagebreak

\thispagestyle{empty}

\begin{PleinePageRuled}
	\LignePapierRuled[Echelle=1.25,Ligne=1]{C. PIERQUET \hfill LaTeX}
	\LignePapierRuled[Echelle=1.25,Ligne=2,Couleur=red]<center>{\underline{\cursive\bfseries Evaluation 3}}
	\CadreNoteRuled{3}
	\LignePapierRuled[Echelle=1.25,Ligne=8,Couleur=ForestGreen]{\sffamily\underline{Exercise 1 :}}
	\ParagraphePapierRuled[Ligne=9]{\cursive\lipsum[1]}
	\ParagraphePapierRuled[Ligne=22]
	{%
		We try with math, $1+\frac12=\frac32$, inline, with several lines.\\
		And another math example, $\int_0^1 2x dx = 1$.\\
		A new line now !
	}
\end{PleinePageRuled}

\pagebreak


\part*{History}

\verb|v0.1.1|~:~~~~Best color choice

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

\end{document}