| 1 |
% !TeX TXS-program:compile = txs:///arara |
| 2 |
% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode} |
| 3 |
% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') |
| 4 |
|
| 5 |
\documentclass[english,11pt,a4paper]{article} |
| 6 |
\usepackage[utf8]{inputenc} |
| 7 |
\usepackage[T1]{fontenc} |
| 8 |
%\usepackage{DejaVuSerif} |
| 9 |
%\usepackage[scale=1.125]{inconsolata} |
| 10 |
\usepackage{pictochrono} |
| 11 |
\usepackage{soul} |
| 12 |
\usepackage{tabularray} |
| 13 |
\usepackage{lipsum} |
| 14 |
\usepackage{codehigh} |
| 15 |
\usepackage{fontawesome5} |
| 16 |
\usepackage{fancyvrb} |
| 17 |
\usepackage{fancyhdr} |
| 18 |
\fancyhf{} |
| 19 |
\renewcommand{\headrulewidth}{0pt} |
| 20 |
%\rhead{\sffamily\small\affloetalab[Legende]} |
| 21 |
\lfoot{\sffamily\small [pictochrono]} |
| 22 |
\cfoot{\sffamily\small - \thepage{} -} |
| 23 |
\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}} |
| 24 |
\usepackage{hologo} |
| 25 |
\usepackage{xspace} |
| 26 |
\providecommand\tikzlogo{Ti\textit{k}Z} |
| 27 |
\providecommand\TeXLive{\TeX{}Live\xspace} |
| 28 |
\providecommand\PSTricks{\textsf{PSTricks}\xspace} |
| 29 |
\let\pstricks\PSTricks |
| 30 |
\let\TikZ\tikzlogo |
| 31 |
|
| 32 |
\usepackage{hyperref} |
| 33 |
\urlstyle{same} |
| 34 |
\hypersetup{pdfborder=0 0 0} |
| 35 |
\usepackage[margin=2cm]{geometry} |
| 36 |
\setlength{\parindent}{0pt} |
| 37 |
|
| 38 |
\def\TPversion{0.1.1} |
| 39 |
\def\TPdate{25/06/2025} |
| 40 |
\usepackage{tcolorbox} |
| 41 |
|
| 42 |
\sethlcolor{lightgray!25} |
| 43 |
\NewDocumentCommand\MontreCode{ m }{% |
| 44 |
\hl{\vphantom{\texttt{pf}}\texttt{#1}}% |
| 45 |
} |
| 46 |
|
| 47 |
\usepackage{babel} |
| 48 |
|
| 49 |
\begin{document} |
| 50 |
|
| 51 |
\pagestyle{fancy} |
| 52 |
|
| 53 |
\thispagestyle{empty} |
| 54 |
|
| 55 |
\begin{center} |
| 56 |
\begin{minipage}{0.88\linewidth} |
| 57 |
\begin{tcolorbox}[colframe=yellow,colback=yellow!15] |
| 58 |
\begin{center} |
| 59 |
\begin{tabular}{c} |
| 60 |
{\Huge \texttt{pictochrono}}\\ |
| 61 |
\\ |
| 62 |
{\LARGE A chronometer, made with Ti\textit{k}Z,} \\ |
| 63 |
\\ |
| 64 |
{\LARGE for inline insertion.} \\ |
| 65 |
\\ |
| 66 |
{\small \texttt{Version \TPversion{} -- \TPdate}} |
| 67 |
\end{tabular} |
| 68 |
\end{center} |
| 69 |
\end{tcolorbox} |
| 70 |
\end{minipage} |
| 71 |
\end{center} |
| 72 |
|
| 73 |
\begin{center} |
| 74 |
\begin{tabular}{c} |
| 75 |
\texttt{Cédric Pierquet}\\ |
| 76 |
{\ttfamily c pierquet -- at -- outlook . fr}\\ |
| 77 |
\texttt{\url{https://forge.apps.education.fr/pierquetcedric/packages-latex}} |
| 78 |
\end{tabular} |
| 79 |
\end{center} |
| 80 |
|
| 81 |
\hrule |
| 82 |
|
| 83 |
\phantomsection |
| 84 |
|
| 85 |
\hypertarget{matoc}{} |
| 86 |
|
| 87 |
\tableofcontents |
| 88 |
|
| 89 |
\vspace*{5mm} |
| 90 |
|
| 91 |
\hrule |
| 92 |
|
| 93 |
\vspace*{5mm} |
| 94 |
|
| 95 |
\vfill |
| 96 |
|
| 97 |
\begin{tcolorbox}[colframe=lightgray,colback=lightgray!10] |
| 98 |
\hfill |
| 99 |
{\pictochrono[Height=4cm]{20}} |
| 100 |
\hfill~ |
| 101 |
\end{tcolorbox} |
| 102 |
|
| 103 |
\medskip |
| 104 |
|
| 105 |
\begin{tcolorbox}[colframe=lightgray,colback=lightgray!10] |
| 106 |
{\LARGE\bfseries\sffamily Exercise n°1 (\pictochrono[ColTime=red]{10})\dotfill(5 points)}\\ |
| 107 |
{\LARGE\bfseries\sffamily Exercise n°2 (\pictochrono[ColTime=blue]{25})\dotfill(9 points)}\\ |
| 108 |
{\LARGE\bfseries\sffamily Exercise n°3 (\pictochrono[Delta=15,ColTime=orange]{35})\dotfill(11 points)} |
| 109 |
\end{tcolorbox} |
| 110 |
|
| 111 |
\vfill~ |
| 112 |
|
| 113 |
\pagebreak |
| 114 |
|
| 115 |
\section{The package pictochrono} |
| 116 |
|
| 117 |
\subsection{Ideas} |
| 118 |
|
| 119 |
The idea is to display a pictogram like "chronometer" to present times for exercises, for example. |
| 120 |
|
| 121 |
The pictogram can be inserted inline with automatic height and vertical offset, or with a manual height and offset. |
| 122 |
|
| 123 |
\subsection{Loading} |
| 124 |
|
| 125 |
The package loads within the preamble, with \MontreCode{\textbackslash usepackage\{pictochrono\}}. |
| 126 |
|
| 127 |
The only loaded packages are \MontreCode{simplekv}, \MontreCode{calc}, \MontreCode{simplekv}, \MontreCode{xstring}, \MontreCode{etoolbox} and \MontreCode{tikz} (with \MontreCode{calc} library). |
| 128 |
|
| 129 |
\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 130 |
\usepackage{pictochrono} |
| 131 |
\end{codehigh} |
| 132 |
|
| 133 |
\section{The command} |
| 134 |
|
| 135 |
\subsection{Usage} |
| 136 |
|
| 137 |
The command is \MontreCode{\textbackslash pictochrono}. |
| 138 |
|
| 139 |
\begin{codehigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 140 |
\pictochrono[keys]{duration}<v.align> |
| 141 |
\end{codehigh} |
| 142 |
|
| 143 |
\medskip |
| 144 |
|
| 145 |
The optional keys are : |
| 146 |
|
| 147 |
\begin{itemize} |
| 148 |
\item the key \MontreCode{Height}: |
| 149 |
\begin{itemize} |
| 150 |
\item can use an automatic height, with \MontreCode{auto} (by default, global height of current font {\setlength\fboxsep{0.25pt}\fbox{\texttt{qB}}} + small vertical offset); |
| 151 |
\item can specify a global height; |
| 152 |
\item the \MontreCode{Strut} key can adjust characters box automatic height; |
| 153 |
\end{itemize} |
| 154 |
\item the key \MontreCode{Color} for the main color (\MontreCode{black} by default); |
| 155 |
\item the key \MontreCode{ColTime} for the color of duration, if specified (\MontreCode{lightgray} by default); |
| 156 |
\item the key \MontreCode{Delta} for the graduations of minutes (within \texttt{0/5/10/15/20/30}) (\MontreCode{5} by default); |
| 157 |
\item the key \MontreCode{Offset} for manual vertical offset (\MontreCode{auto} by default); |
| 158 |
\end{itemize} |
| 159 |
|
| 160 |
\medskip |
| 161 |
|
| 162 |
The mandatory argument, between \MontreCode{\{...\}}, is the duration to be displayed. |
| 163 |
|
| 164 |
\medskip |
| 165 |
|
| 166 |
The optional argument, between \MontreCode{<...>}, can specify a vertical alignment of the pictogram (within \texttt{vcenter/vbottom/vtop}, or empty for default positioning). |
| 167 |
|
| 168 |
\subsection{Examples} |
| 169 |
|
| 170 |
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 171 |
%automatic inline insertion (with an without 'Strut' key) |
| 172 |
This is a test, with a \pictochrono{25} minutes chronometer, or (\pictochrono[Strut=()]{25}). |
| 173 |
\end{demohigh} |
| 174 |
|
| 175 |
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 176 |
%automatic inline insertion, with user colors. |
| 177 |
{\Huge This is an other test, with a |
| 178 |
\pictochrono[Delta=15,Color=blue,ColTime=red]{20} minutes chronometer.} |
| 179 |
\end{demohigh} |
| 180 |
|
| 181 |
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 182 |
%manual inline insertion, with manual offset. |
| 183 |
This a \pictochrono[Height=3em,Offset=-0.75em]{45} minutes chronometer. |
| 184 |
\end{demohigh} |
| 185 |
|
| 186 |
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 187 |
%manual insertion |
| 188 |
\pictochrono[Height=5cm,ColTime=teal]{33} |
| 189 |
\end{demohigh} |
| 190 |
|
| 191 |
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 192 |
%wihtin a tblr |
| 193 |
\begin{tblr}{hlines,vlines,colspec={Q[m,c]Q[8cm,m,j]}} |
| 194 |
\pictochrono[Height=4cm,ColTime=purple]{20} |
| 195 |
& |
| 196 |
\lipsum[1][1-9] \\ |
| 197 |
\end{tblr} |
| 198 |
\end{demohigh} |
| 199 |
|
| 200 |
\begin{demohigh}[language=latex/latex2,style/main=cyan!10,style/code=cyan!10] |
| 201 |
%wihtin a tblr |
| 202 |
\begin{tblr}{hlines,vlines,colspec={Q[m,c]Q[8cm,m,j]}} |
| 203 |
\pictochrono[Height=4cm,ColTime=purple]{20}<vcenter> |
| 204 |
& |
| 205 |
\lipsum[1][1-9] \\ |
| 206 |
\end{tblr} |
| 207 |
\end{demohigh} |
| 208 |
|
| 209 |
\vfill |
| 210 |
|
| 211 |
\section{History} |
| 212 |
|
| 213 |
\verb|v0.1.1|~:~~~~New key \textsf{[strut=...]} for adapting (auto-)height |
| 214 |
|
| 215 |
\verb|v0.1.0|~:~~~~Initial version |
| 216 |
|
| 217 |
\vspace*{15mm} |
| 218 |
|
| 219 |
\end{document} |