% !TeX TXS-program:compile = txs:///arara
% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode}
% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode}

\documentclass[11pt,a4paper]{ltxdoc}
%\usepackage{amsmath}
%\usepackage{bera}
%\usepackage{inconsolata}
%\usepackage[T1]{fontenc}
%\usepackage[scale=0.875]{cabin}
\usepackage[T1]{fontenc}
\usepackage[nott]{kpfonts}
\usepackage{inconsolata}
\usepackage{tikz-decofonts}
\usepackage{enumitem}
\usepackage{fancyvrb}
\usepackage{lipsum}
\usepackage{setspace}
\usepackage{fancyhdr}
\usepackage{tabularray}
\usepackage{fontawesome5}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\lfoot{\sffamily\small [tikz-decofonts]}
\cfoot{\sffamily\small - \thepage{} -}
\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}}
\usepackage{hologo}
\providecommand\tikzlogo{Ti\textit{k}Z}
\providecommand\TeXLive{\TeX{}Live\xspace}
\let\TikZ\tikzlogo

\usepackage{hyperref}
\urlstyle{same}
\hypersetup{pdfborder=0 0 0}
\usepackage[margin=2cm]{geometry}
\setlength{\parindent}{0pt}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins,hooks,listingsutf8}

\lstset{
  language=[LaTeX]TeX,%
  basicstyle=\ttfamily,%
  keywordstyle={\color{blue}},%
  classoffset=0,%
  keywords={},%
  alsoletter={-},%
  keywordstyle={\color{blue}},%
  classoffset=1,%
  alsoletter={-},%
  morekeywords={commalists-tools},%
  keywordstyle={\color{violet}},%
  classoffset=2,%
  alsoletter={-},%
  morekeywords={\tkzbrush,\tkzink,\tkzpixl,\tkzpixletter,\tkzpixlquote,\tkzcomicbubble,\tkzunderline,\tkzsurround,\tkzfittextinarrow,\tkzcircledtxt,\tkzletterblock,\tkzunderlinepen,\phantomulinewithpen,\tkzpencircle,\calligraphypencircle,\calligraphy,\tkzmulticancel,\tkzmultibcancel,\tkzmultixcancel,\tkzmulticancelto},%
  keywordstyle={\color{green!50!black}},%
  classoffset=3,%
  morekeywords={},%
  keywordstyle={\color{orange}}
}

\newtcblisting{DemoCode}[1]{%
  enhanced,width=\linewidth,%
  bicolor,size=title,%
  colback=cyan!10!white,%
  colbacklower=cyan!5!white,%
  colframe=cyan!75!black,%
  listing options={%
    breaklines=true,%
    breakatwhitespace=true,%
    style=tcblatex,basicstyle=\small\ttfamily,%
    tabsize=4,%
    commentstyle={\itshape\color{gray}},
    keywordstyle={\color{blue}},%
    classoffset=0,%
    keywords={\usepackage,\includegraphics,xstring,listofitems,\readlist,\showitems,\xintFor,\xintSeq},%
    alsoletter={-},%
    keywordstyle={\color{blue}},%
    classoffset=1,%
    alsoletter={-},%
    morekeywords={euromoney},%
    keywordstyle={\color{violet}},%
    classoffset=2,%
    alsoletter={-},%
    morekeywords={\tkzbrush,\tkzink,\tkzpixl,\tkzpixletter,\tkzpixlquote,\tkzbicolor,\tkzcomicbubble,\tkzunderline,\tkzsurround,\tkzfittextinarrow,\tkzcircledtxt,\tkzletterblock,\tkzunderlinepen,\phantomulinewithpen,\tkzpencircle,\calligraphypencircle,\calligraphy,\tkzmulticancel,\tkzmultibcancel,\tkzmultixcancel,\tkzmulticancelto},%
    keywordstyle={\color{green!50!black}},%
    classoffset=3,%
    morekeywords={color,lines,scale,height,offseth,offsetv,thick,gridcolor,gridafter,nospaceafter,border,colors,style,intdelta,paralcolors,width,node,txtcolor,width,bheight,sheight,hoffset,shadow,shownodes,expand,globalwidth,absolute,thickness,strut,dstrut,hstretch,font,height,spacestretch,ratio,angle,line,width,centered,sep,extend,arrow,lines,type,target},%
    keywordstyle={\color{orange}}
  },%
  #1
}

\newtcbinputlisting\DemoCodeFile[1]{%
  enhanced,width=\linewidth,%
  bicolor,size=title,%
  colback=lightgray!10!white,%
  colbacklower=lightgray!5!white,%
  colframe=lightgray!75!black,%
  listing options={%
    breaklines=true,%
    breakatwhitespace=true,%
    style=tcblatex,
    basicstyle=\scriptsize\ttfamily,%
    tabsize=4,%
    commentstyle={\itshape\color{gray}},%
    %lastline=148
  },%
  breakable,
  listing only,%
  listing file={#1}
}

\NewDocumentCommand\ShowCode{ m }{%
  \lstinline{#1}%
}

\def\sampleformula{$\displaystyle\int_0^1 \dfrac{1+x}{1+x^2}\,\mathrm{d}x$}
\def\sampletxt{But I must explain to you how all this mistaken idea of denouncing pleasure.}
\def\samplenum{1500}

\begin{document}

\thispagestyle{empty}

\begin{center}
  \begin{minipage}{0.88\linewidth}
    \begin{tcolorbox}[colframe=yellow,colback=yellow!15]
      \begin{center}
        \renewcommand{\arraystretch}{1.25}%
        \begin{tabular}{c}
          {\Huge \texttt{tikz-decofonts}}\\
          \\
          {\LARGE Simple "decoration" fonts or effects,} \\
          {\LARGE made with Ti\textit{k}Z, for small texts\ldots} \\
          \\
          {\small \texttt{Version \tkzdfversion{} -- \tkzdfdate}}
        \end{tabular}
      \end{center}
    \end{tcolorbox}
  \end{minipage}
\end{center}

\begin{center}
  \begin{tabular}{c}
    \texttt{Cédric Pierquet}\\
    {\ttfamily c pierquet -- at -- outlook . fr}\\
    \texttt{\url{https://github.com/cpierquet/latex-packages/tree/main/tikz-decofonts}} \\
  \end{tabular}
\end{center}

\hrule

\vfill

\begin{tcblisting}{colframe=lightgray,colback=lightgray!5,listing only}
%paintbrush effect
\tkzbrush[color=blue]{DECORATION}
%paintink effect
\tkzink[color=orange]{DECORATION}
%pixeletter effect
\tkzpixl[color=violet]{DECORATION}
%bicolor effect
\tkzbicolor[colors=blue/red,style=ndiag]{\Huge\sffamily DECORATION}
\tkzbicolor[colors=teal/orange,style=ellips]{\Huge\sffamily DECORATION}
%surround effect
\tkzsurround[color=orange]{$I= \displaystyle\int_{a}^{b} f(x) \textrm{d}x = F(b)-F(a)$}
\end{tcblisting}

\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
\tkzbrush[color=blue]{DECORATION}
\end{tcolorbox}

\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
\hfill\tkzink[color=orange]{DECORATION}\hfill~
\end{tcolorbox}

\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
\hfill\tkzpixl[color=violet]{Decoration}
\end{tcolorbox}

\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
\hfill\tkzbicolor[colors=blue/red,style=ndiag]{\Huge\sffamily DECORATION}~~\tkzbicolor[colors=teal/orange,style=ellips]{\Huge\sffamily DECORATION}\hfill~
\end{tcolorbox}

\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
\hfill\tkzsurround[color=orange]{$I= \displaystyle\int_{a}^{b} f(x) \textrm{d}x = F(b)-F(a)$}\hfill~
\end{tcolorbox}

\vfill~

\hrule

\vspace*{5mm}

\textit{Ideas and parts of codes, with \texttt{CC\,BY-SA\,4.0} or \texttt{LPPL 1.3c} licenses, come from :}

\begin{itemize}
  \item \href{https://tex.stackexchange.com/questions/475141/simulating-paintbrush-strokes-in-tikz}{[link on tex.stackexchange]} from \textsf{user121799} for paintbrush;
  \item \href{https://tex.stackexchange.com/questions/460836/custom-line-cap-to-simulate-inked-line-in-tikz/460842#460842}{[link on tex.stackexchange]} from \textsf{user121799} for inkbrush ;
  \item \href{https://github.com/meyvenil0844-byte/-multicancel}{[link on github]} from \textsf{meyvenil0844-byte} for multicancel.
\end{itemize}

\pagebreak

\phantomsection

\hypertarget{matoc}{}

\tableofcontents

\vspace*{5mm}

%\hrule

\pagebreak

\section{Loading, useful packages, purposes and acknowledgments}

\subsection{Loading and useful packages}

In order to load \texttt{tikz-decofonts}, simply use:

\begin{DemoCode}{listing only}
\usepackage{tikz-decofonts}
\end{DemoCode}

Loaded packages are \texttt{tikz}, \texttt{tikz-3dplot}, \texttt{settobox}, \texttt{xintexpr}, \texttt{simplekv}, \texttt{listofitems}, \texttt{xstring}, \texttt{ifthen} and \texttt{calc}.

Loaded \texttt{tikz.librairies} are \texttt{decorations}, \texttt{decorations.pathreplacing}, \texttt{calc}, \texttt{positioning}, \texttt{bbox}, \texttt{calligraphy}, \texttt{arrows.meta}, \texttt{shapes.callouts} and \texttt{bending}.

\smallskip

Globally, height of rendering is about 1cm, but some customization are available.

\subsection{Purposes and acknowledgments}

The purposes of this small package is not to provide full fonts, with all characters, but give restricted possibility to present \textbf{short} texts of title with \textit{cute} effects.

\smallskip

These decorations are not destined to be use for whole paragraphs or texts, but just for fun for small titles or small texts.

\smallskip

Since many calculations are required internally, compilation time can be increased, so be careful with intensive use!

\smallskip

\textit{Ideas and parts of codes, with \texttt{CC\,BY-SA\,4.0} licenses, come from:}

\begin{itemize}
  \item \href{https://tex.stackexchange.com/questions/475141/simulating-paintbrush-strokes-in-tikz}{[link on tex.stackexchange]} from \textsf{user121799} for paintbrush;
  \item \href{https://tex.stackexchange.com/questions/460836/custom-line-cap-to-simulate-inked-line-in-tikz/460842#460842}{[link on tex.stackexchange]} from \textsf{user121799} for inkbrush ;
  \item \href{https://github.com/meyvenil0844-byte/-multicancel}{[link on github]} from \textsf{meyvenil0844-byte} for multicancel.
\end{itemize}

Some adjustments (keys, paths) are maid from original code, but the global usage is due to the links above!

\pagebreak

\section{The different effects}

\subsection{Paint brush}

{\small\faBomb} The effect is \textbf{very} \textit{time-consuming} to compile!!

\begin{DemoCode}{listing only}
%only uppercase letters allowed
\tkzbrush[color=...,lines=...,scale=...]<tikzpicture options>{short text}

%color = black by default
%lines = 12 by default
%scale = 1 by default
\end{DemoCode}

\begin{DemoCode}{listing only}
%default output
\tkzbrush{TIKZ DECORATION}
\end{DemoCode}

\begin{DemoCode}{text only}
%default output
\tkzbrush{TIKZ DECORATION}

\end{DemoCode}

\begin{DemoCode}{listing only}
%customization(s) (external file for speeding rendering ^^)
\tkzbrush[color=red,lines=20,scale=1.5]{CUSTOM TEXT}
\end{DemoCode}

\begin{DemoCode}{text only}
%customization(s) (external file for speeding rendering ^^)
\includegraphics{tkzbrushA.pdf}
\end{DemoCode}

\pagebreak

\subsection{Ink brush}

\begin{DemoCode}{listing only}
%only uppercase letters allowed
\tkzink[color=...,thick=...,scale=...]<tikzpicture options>{short text}

%color = black by default
%thick = 3 by default
%scale = 1 by default
\end{DemoCode}

\begin{DemoCode}{}
%default output
\tkzink{TIKZ DECORATION}
\end{DemoCode}

\begin{DemoCode}{}
%customization(s)
\tkzink[color=olive,thick=5,scale=2]{TIKZ DECORATION}
\end{DemoCode}

\pagebreak

\subsection{Pixl brush}

\begin{DemoCode}{listing only}
%regular letters allowed (upper and/or lower), rendered characters are 5 columns x 7 lines
\tkzpixl%
    [height=...,thick=...,color=...,gridcolor=...,border=...,
    offseth=...,offsetv=...,gridafter=...,nospaceafter=...]
    <tikzpicture options>{short text}

\tkzpixletter%
    [height=...,thick=...,color=...,gridcolor=...,border=...,
    offseth=...,offsetv=...,gridafter=...,nospaceafter=...]
    <tikzpicture options>{letter}

\tkzpixlquote%if problem with '...
    [height=...,thick=...,color=...,gridcolor=...,
    offseth=...,offsetv=...,gridafter=...,nospaceafter=...]
    <tikzpicture options>

%height = 11mm by default, thick = 0.1mm by default
%color = black by default, gridcolor = gray by default
%offseth = 1 by default (squares left/right of regular character)
%offsetv = 2 by default (squares above/below of regular character)
%boder = false by default (boolean for adding border)
%gridafter = false by default (boolean for showing grid after pixls)
%nospaceafter = false by default (boolean for removeing hspace after pixls)
\end{DemoCode}

\begin{DemoCode}{}
%default output, comparaison with character w/o offsets (5*7)
\tkzpixl{And then, 1+1=2 !?!} and \tkzpixletter[offseth=0,offsetv=0]{*}
\end{DemoCode}

\begin{DemoCode}{}
%customization(s)
\tkzpixl[color=violet,height=1.75cm,gridafter,offsetv=3,border]{Small custo'm text}
\end{DemoCode}

\pagebreak

\subsection{Bicolor effect}

\begin{DemoCode}{listing only}
%compatible with all fonts and/or sizes
\tkzbicolor%
    [colors=...,style=...,intdelta=...]
    {text}

\tkzbicolor%with paral style
    [paralcolors=...,style=paral,intdelta=...]
    {text}

%style = midh/midv/rect/ellips/paral (paral by default)
%colors = red/blue by default,
%paralcolors = red/blue/orange/gray by default
%intdelta = 0.66 by default, percentage of int dim for ellips/rect
\end{DemoCode}

\begin{DemoCode}{listing only}
\def\sampleformula{$\displaystyle\int_0^1 \dfrac{1+x}{1+x^2}\,\mathrm{d}x$}
\def\sampletxt{But I must explain to you how all this mistaken idea of denouncing pleasure.}
\def\samplenum{1500}
\end{DemoCode}

\begin{DemoCode}{}
\tkzbicolor[style=midh]{\sampleformula}
or \tkzbicolor[colors=violet/magenta,style=midv]{\sampleformula}
or \tkzbicolor[colors=darkgray/olive,style=ndiag]{\sampleformula}
or \tkzbicolor[colors=orange/teal,style=sdiag]{\sampleformula}
or \tkzbicolor[colors=orange/teal,style=ellips]{\sampleformula}
or \tkzbicolor[colors=pink/violet,style=rect]{\sampleformula}
\end{DemoCode}

\begin{DemoCode}{}
\tkzbicolor[style=midh]{\sampletxt}\par
\tkzbicolor[colors=violet/magenta,style=midv]{\sampletxt}\par
\tkzbicolor[colors=darkgray/olive,style=ndiag]{\sampletxt}\par
\tkzbicolor[colors=orange/teal,style=sdiag]{\sampletxt}\par
\tkzbicolor[colors=orange/teal,style=ellips]{\sampletxt}\par
\tkzbicolor[colors=pink/violet,style=rect]{\sampletxt}
\end{DemoCode}

\begin{DemoCode}{}
\tkzbicolor[style=midh]{\parbox{2.5cm}{\sampletxt}}
\tkzbicolor[colors=violet/gray,style=midv]{\parbox{2.5cm}{\sampletxt}}
\tkzbicolor[colors=darkgray/olive,style=ndiag]{\parbox{2.5cm}{\sampletxt}}
\tkzbicolor[colors=orange/cyan,style=sdiag]{\parbox{2.5cm}{\sampletxt}}
\tkzbicolor[colors=pink/violet,style=ellips]{\parbox{2.5cm}{\sampletxt}}
\tkzbicolor[colors=pink/violet,style=ellips,intdelta=0.85]{\parbox{2.5cm}{\sampletxt}}
\tkzbicolor[colors=cyan/darkgray,style=rect]{\parbox{2.5cm}{\sampletxt}}
\end{DemoCode}

\begin{DemoCode}{}
\tkzbicolor[style=paral]{\parbox{6cm}{\large\sffamily\sampletxt}}
\end{DemoCode}

\begin{DemoCode}{}
\tkzbicolor[style=midh]{\samplenum}\par
\tkzbicolor[colors=violet/magenta,style=midv]{\samplenum}\par
\tkzbicolor[colors=darkgray/olive,style=ndiag]{\samplenum}\par
\tkzbicolor[colors=orange/teal,style=sdiag]{\samplenum}\par
\tkzbicolor[colors=orange/teal,style=ellips]{\samplenum}
\end{DemoCode}

\pagebreak

\subsection{Comic bubble}

\begin{DemoCode}{listing only}
%style tikz
\tikzset{comicbubble/.style args={#1#2}{%
  inner sep=1mm,line join=round,rectangle callout,draw,very thick,
  text width=#1,align=flush center,callout relative pointer=#2}}
\end{DemoCode}

\begin{DemoCode}{listing only}
%independant macro
\tkzcomicbubble[%
    width=...,coltxt=...,colbg=...,colframe=...,pospointer=(...),
    font=...,rcorners=true/false]%
    <tikz options>{text}

%with tikzpicture environment
\begin{tikzpicture}
    %...
    \tkzcomicbubble*[%
        width=...,coltxt=...,colbg=...,colframe=...,pospointer=(...),
        font=...,rcorners=true/false]%
        <tikz options>{text}
\end{tikzpicture}
\end{DemoCode}

\begin{DemoCode}{}
\def\mytext{Let's play with Pythagoras !\relax}
\tkzcomicbubble[font=\large\bfseries\itshape]{\mytext}~~
\tkzcomicbubble%
    [width=3cm,coltxt=red,colframe=teal,font=\bfseries,
    colbg=yellow!15,pospointer={(150:1em)},rcorners]%
    <thick>%
    {\mytext}
\end{DemoCode}

\begin{DemoCode}{}
%\usepackage{setspace}
\def\mytext{Let's use Pythagoras !\relax}
{\tikz[rotate=-15,transform shape]\tkzcomicbubble*[width=2.5cm,font=\large\sffamily]<execute at begin node={\setlength{\baselineskip}{0.75\baselineskip}}>{\mytext};}
\end{DemoCode}

\pagebreak

\subsection{Surround effect}

\begin{DemoCode}{listing only}
\tkzsurround[width=...,node=...,color=...]{text}

%width = width of line (1.25pt by default)
%color = red by default
%node  = name of node (AAAAZ by default)
\end{DemoCode}

\begin{DemoCode}{}
\tkzsurround[node=AAA]{This is a sample text} and we're trying to see what it does
by \tkzsurround[color=blue,width=1.5pt,node=BBB]{surrounding} certain portions of the text!

{\tikz[remember picture,overlay]
    \draw[densely dashed,orange,<->,very thick,>=latex]
    ([yshift=-1mm]AAA.south east) to[bend right] ([yshift=-1mm]BBB.south west) ;
}
\end{DemoCode}

\subsection{Underline effect}

\begin{DemoCode}{listing only}
\tkzunderline[width=...,node=...,color=...,height=...]{text}

%width  = width of line (1.25pt by default)
%color  = red by default
%height = global height of underlining (10mm by default)
%node   = name of node (AAAAZ by default)
\end{DemoCode}

\begin{DemoCode}{}
\tkzunderline{This is a sample text} with
\tkzunderline[color=blue,width=1.5pt,height=15mm]{underlining} certain
\tkzunderline[color=yellow,width=1pt,height=15pt]{portions}!
\end{DemoCode}

\pagebreak

\subsection{Arrow with fitted text}

\begin{DemoCode}{listing only}
\tkzbrush[<keys>]<tikzpicture options>{text}

%color       = color of arrow (gray)
%txtcolor    = color of text (white)
%width       = width 'with or without ending' width of arrow (2cm)
%bheight     = big height (8mm)
%sheight     = small height (4mm)
%hoffset     = text h offset (0.2mm)
%shadow      = boolean for shadow (true)
%shownodes   = boolean for helping nodes (false)
%expand      = use 'max' width for txt (false)
%globalwidth = boolean for width including 'ending' (false)
\end{DemoCode}

Nodes (eg for positionning) are:
%
\begin{multicols}{2}
  \begin{itemize}
    \item \texttt{arrow-bottomleft}
    \item \texttt{arrow-topleft}
    \item \texttt{arrow-begin}
    \item \texttt{arrow-end}
    \item \texttt{arrow-textcenter}
    \item \texttt{arrow-bottom}
    \item \texttt{arrow-textright}
    \item \texttt{arrow-top}
    \item \texttt{arrow-smallbottom}
    \item \texttt{arrow-smalltop}
  \end{itemize}
\end{multicols}

\begin{DemoCode}{}
\tkzfittextinarrow%
  [bheight=3cm,sheight=1.75cm,width=6cm,color=orange,shownodes]%
  {\vphantom{q}Demo}
\end{DemoCode}

\begin{DemoCode}{}
\tkzfittextinarrow%
  [bheight=3cm,sheight=1.75cm,width=6cm,color=teal,globalwidth,expand,txtcolor=yellow]%
  {\vphantom{q}\bfseries\sffamily Demo}
\end{DemoCode}

\begin{DemoCode}{}
\tkzfittextinarrow%
  [bheight=2cm,sheight=1cm,width=5cm,color=orange,expand]%
  {\vphantom{q}Démonstration}
\end{DemoCode}

\begin{DemoCode}{}
Text before
\tkzfittextinarrow%
  [bheight=1em,sheight=0.6em,width=3em,color=green!50!black]%
  <rotate=-15,baseline=(arrow-smallbottom)>%
  {\itshape My examples}
\tkzfittextinarrow%
  [bheight=1em,sheight=0.6em,width=3em,color=green!50!black,expand]%
  <rotate=15,baseline=(arrow-textcenter)>%
  {\ttfamily My examples}
with text after
\end{DemoCode}

\pagebreak

\subsection{Freehand circled text}

\begin{DemoCode}{listing only}
\tkzcircledtxt[<keys>]<tikzpicture options>{text}

%height              = height for manual insertion (2em)
%width               = width for manual insertion (2.3em)
%thickness           = thickness, percentage of height (0.05)
%absolute thickness  = absolute thickness, length (-)
%fill color          = bg color (lightgray!30)
%rule color          = boxrule color (black)
%rotate              = optional rotation (0)
%auto                = auto width/height/raise relative to len of inside text (0)
%fill                = boolean for filling (true)
%font                = optional font
%vstretch            = coefficient for vertical stretch, with auto usage (1.5)
%hoffset             = coefficient for horizontal offset with auto usage (0.8)
%random              = boolean for random effect (false)
%arabic              = boolean for arabic version of counter (false)
%alph                = boolean for alph version of counter (false)
%Alph                = boolean for Alpha version of counter (false)
\end{DemoCode}

\begin{DemoCode}{}
%manual insertion (height + width + font)
{q\LARGE\sffamily\bfseries\tkzcircledtxt{99}\tkzcircledtxt[absolute thickness=1pt]{99}H}\\
{q\LARGE\sffamily\bfseries\tkzcircledtxt[random]{99}H}\\
{q\LARGE\sffamily\bfseries\tkzcircledtxt[random]{text}H}
\end{DemoCode}

\begin{DemoCode}{}
%automatic insertion relative to len of small text
{\Huge q\tkzcircledtxt[auto=1]{7}H or q\tkzcircledtxt[auto=2]{7}H}\\
{\Huge q\tkzcircledtxt[auto=2]{99}H or q\tkzcircledtxt[auto=3]{99}H}\\
{\Huge q\tkzcircledtxt[auto=2]{154}H or q\tkzcircledtxt[auto=3]{154}H }
\end{DemoCode}

\begin{DemoCode}{}
%with custom font
{\Huge\sffamily q\tkzcircledtxt[font=\small\ttfamily,auto=3]{105}H}
\end{DemoCode}

\begin{DemoCode}{}
\tkzcircledtxt[auto=1]{7} Let $f$ defined by $f(x)=x^{2}+5x-3$.
\end{DemoCode}

\begin{DemoCode}{}
%with enumitem package
\begin{enumerate}[label={%
    \color{darkgray}%
    \tkzcircledtxt[thickness=0.075,fill=false,arabic,font=\large\bfseries,auto=1,%
    fill color=teal!25,rule color=orange]{\arabic*}%
    }%
  ]
  \item AAF
  \item AAF
  \begin{enumerate}[label={%
      \color{red}%
      \tkzcircledtxt[thickness=0.0375,fill=false,hoffset=0.25,alph,%
      font=\bfseries,auto=1,rule color=teal]{\alph*}%
      }%
    ]
    \item AA
    \item BGHMG
  \end{enumerate}
  \item AAF
  \item AAF
  \item AAF
  \item AAF
  \item AAF
  \item AAF
  \item AAF
\end{enumerate}
\end{DemoCode}

\pagebreak

\subsection{Block (3D) of letters}

\begin{DemoCode}{listing only}
\tkzcircledtxt[<keys>]<tikzpicture options>{list of blocks}

%height        = height dim or auto/dauto for inline usage (dauto)
%hstretch      = h sep coefficient (1.05)
%spacestretch  = space sep coefficient (0.25)
%dstrut        = characters for dauto usage (qH)
%strut         = characters for auto usage (H)
%font          = font for labels (\huge\bfseries\sffamily)

%list of blocks within letter1/colorblock1/colorletter1,...
%use * for 'space'
\end{DemoCode}

\begin{DemoCode}{}
{\LARGE%
q%
\tkzletterblock%
  {%
    C/red/white,H/blue/white,A/violet/white,%
    P/yellow/black,T/white/black,E/orange/black,%
    R/teal/white,*/magenta/white,0/cyan/white,7/pink/white%
  }%
H%
}
\end{DemoCode}

\begin{DemoCode}{}
\sffamily\bfseries\Huge%
H%
\tkzletterblock%
  [height=auto]%
  {%
    L/red/white,A/blue/white,T/violet/white,E/cyan/white,X/pink/white%
  }%
H
\end{DemoCode}

\begin{DemoCode}{}
%green lines for visualizing manual height
{\tikz\draw[thick,green] (0,0)--(0,1.75cm);}%
\tkzletterblock%
  [height=1.75cm,hstretch=1.25,font=\Huge\ttfamily,spacestretch=0.5]%
  {%
    D/yellow/black,E/white/black,*//,C/orange/black,O/teal/white%
  }%
{\tikz\draw[thick,green] (0,0)--(0,1.75cm);}%
\end{DemoCode}

\pagebreak

\subsection{Underline with pen pictogram}

\begin{DemoCode}{listing only}
%main macro
\tkzunderlinepen[keys]{text}
%macro with hphantom of pen
\phantomulinewithpen

%thick          = thickness (0.8pt)
%color          = color for underling
%chardepth      = characters for depth calculus
%vstretchoffset = float for raising depth (0.5)
%scale          = scale of pen (1)
%swap           = boolean for 'downside' version (false)
\end{DemoCode}

\begin{DemoCode}{}
\tkzunderlinepen{Exercise n°1}\par
\lipsum[1][1-3]

\tkzunderlinepen[swap]{Exercise n°1}\par
\phantomulinewithpen\lipsum[1][1-3]
\end{DemoCode}

\begin{DemoCode}{}
{\bfseries\sffamily\LARGE\textcolor{blue}{\tkzunderlinepen[thick=1pt]{Exercise n°2}}}\par
\lipsum[1][1-3]

{\bfseries\sffamily\LARGE\textcolor{violet}{\tkzunderlinepen[color=teal]{Exercise n°3}}}\par
\lipsum[1][1-3]

{\bfseries\sffamily\LARGE\textcolor{brown}{\tkzunderlinepen[color=orange]{Exercise (important) n°4}}}\par
\lipsum[1][1-3]
\end{DemoCode}

\pagebreak

\subsection{Calligraphy pen (like \texttt{pencircle} in MetaPost) with calligraphy library}

\subsubsection{Global usage}

This macro is a wrapper around the \TikZ\ \ShowCode{calligraphy} library, designed to mimic the \texttt{pencircle} syntax from \hologo{METAPOST}:

\begin{DemoCode}{listing only}
pickup pencircle xscaled penunita yscaled penunitb rotated angle ;
\end{DemoCode}

The \ShowCode{calligraphy} library models the pen as two orthogonal segments
(major and minor axes), whose lengths control the stroke width variation.

\smallskip

See the doc: \url{https://ctan.org/pkg/spath3} within \texttt{Use for calligraphy}.

\begin{DemoCode}{listing only}
%configure the pen (to use before \calligraphy)
\calligraphypencircle(*)[keys]

%starred (*) = outside tikz environment
%angle       = angle of the pen (60)
%line width  = width of the pen (3bp)
%ratio       = ratio xy axis (1/8)
%name        = name of defined pen (empty)
%double      = boolean for both axis (true)

%then use calligraphy as usual
\calligraphy[options] path ;
\end{DemoCode}

\begin{DemoCode}{}
\begin{tikzpicture}
  \calligraphypencircle
  \calligraphy (0,0) circle[x radius=1.5cm,y radius=2cm] ;
\end{tikzpicture}
\begin{tikzpicture}
  \calligraphypencircle[angle=45]
  \calligraphy (0,0) circle[x radius=1.5cm,y radius=2cm] ;
\end{tikzpicture}
\begin{tikzpicture}
  \calligraphypencircle[angle=-60,line width=4mm,ratio=0.1]{}
  \calligraphy (0,0) circle[x radius=1.5cm,y radius=2cm] ;
\end{tikzpicture}
\end{DemoCode}

\begin{DemoCode}{}
\begin{tikzpicture}
  \calligraphypencircle[line width=2mm]
  \calligraphy[]
  (0,0) .. controls (1,2) and (2,-1) .. (3,1)
  .. controls (4,3) and (5,0)  .. (6,1) ;
\end{tikzpicture}
\end{DemoCode}

\begin{DemoCode}{}
\begin{tikzpicture}
  \calligraphypencircle[line width=4mm,double=false]
  \calligraphy[pen colour=red!50!black]
  (0,0) .. controls (1,2) and (2,-1) .. (3,1)
  .. controls (4,3) and (5,0)  .. (6,1) ;
\end{tikzpicture}
\end{DemoCode}

\begin{DemoCode}{}
\calligraphypencircle*[name=styleA,angle=60,line width=3bp]
\calligraphypencircle*[name=styleB,angle=0, line width=6bp,double=false]

\begin{tikzpicture}
  \calligraphy[use pen=styleA] (0,0) circle[x radius=1cm, y radius=2cm] ;
  \calligraphy[use pen=styleB] (4,0) circle[x radius=1cm, y radius=2cm] ;
\end{tikzpicture}
\end{DemoCode}

\pagebreak

\subsubsection{Predefined pens}

The following pens are predefined and available without any configuration.
Each pen is available in English and French.

\begin{DemoCode}{listing only}
%English / Français    -- angle  lw     ratio
%--------------------------------------------
%nib     / plume       -- 60°    3bp    1/8
%italic  / italique    -- 45°    3bp    1/6
%copper  / cuivre      -- 30°    2bp    1/10
%brush   / pinceau     -- 70°    5bp    1/4
%marker  / marqueur    -- 0°     6bp    1/3
%chisel  / ciseau      -- 45°    4bp    1/5
%pencil  / crayon      -- 60°    2bp    1/12
%chalk   / craie       -- 80°    6bp    1/3
%reed    / roseau      -- 45°    4bp    1/6
%fude    / japonais    -- 85°    6bp    ---
\end{DemoCode}

\begin{DemoCode}{}
\begin{tikzpicture}
  \foreach \penname/\xpos in {%
    nib/0,italic/1.5,copper/3,brush/4.5,marker/6,%
    chisel/7.5,pencil/9,chalk/10.5,reed/12,fude/13.5%
    }{%
  \begin{scope}[xshift=\xpos cm]
      \calligraphy[use pen=\penname]
        (0,0) circle[x radius=0.6cm, y radius=1cm] ;
        \node[below, font=\tiny\ttfamily] at (0,-1.2cm) {\penname} ;
    \end{scope}
  }
\end{tikzpicture}
\end{DemoCode}

\begin{DemoCode}{}
\begin{tikzpicture}
  \calligraphy[use pen=fude, taper]
    (0,0) .. controls (2.5,1.5) and (-3.5,2.75) .. (0,3) ;
\end{tikzpicture}
\end{DemoCode}

\pagebreak

\subsection{Multiple cancellation lines}

\subsubsection{Credits}

Original version of code come from \textsf{meyvenil0844-byte} user, within its \href{https://github.com/meyvenil0844-byte/-multicancel}{[github]} repository !

\subsubsection{Usage}

Parallel cancellation lines (\textit{stacked} or \textit{counting} style) over an expression,
in maths or in text, with a chosen type, number of lines, color, or an arrow with a target value.

\begin{DemoCode}{listing only}
\tkzmulticancel[<keys>]<tikzpicture options>{expression}

%type       = slash (default), backslash, cross or to (last line is an arrow)
%target     = text at the end of the arrow, for type=to (empty by default)
%lines      = number of lines (1 by default)
%color      = color of the lines (black by default)
%centered   = boolean for the 'counting' style, see below (false by default)
%sep        = gap between two lines (2.5pt by default) or two bars if centered (0pt)
%extend     = overshoot of the lines out of the expression (1.5pt by default)
%arrow      = arrow tip for type=to (-latex by default)

%TikZ style 'tkzmulticancel line' (semithick by default) is applied to all the lines
\end{DemoCode}

\begin{DemoCode}{}
%default (stacked) style
$\tkzmulticancel{x}+y$ \quad
$\tkzmulticancel[lines=3,color=red]{x+y}$ \quad
$\tkzmulticancel[type=backslash,lines=2,color=blue]{A\cdot B}$ \quad
$\tkzmulticancel[type=cross,lines=3,color=purple]{M_n}$ \quad
$\tkzmulticancel[type=to,target=0,lines=2,color=orange]{f(x)-f(x)}$
\end{DemoCode}

Outside of math mode, the argument is typeset as text.

\begin{DemoCode}{}
A \tkzmulticancel[lines=2,color=red]{cancelled} word.
\end{DemoCode}

\smallskip

By default, the lines are \textbf{stacked}: they are parallel and shifted \textit{perpendicularly}
to their direction. With the boolean key \texttt{centered}, \(n\) bars are drawn side by side instead,
like counting marks: they are evenly spread over the \textbf{whole width} of the expression
and are as \textbf{tall} as it is, so they adapt to its size (with \texttt{lines=1}, both styles give the same diagonal).

\begin{DemoCode}{}
%centered style
$\tkzmulticancel[lines=3,color=red,centered]{x+y}$ \quad
$\tkzmulticancel[type=backslash,lines=3,color=blue,centered]{A\cdot B}$ \quad
$\tkzmulticancel[type=cross,lines=2,color=purple,centered]{M_n}$ \quad
$\tkzmulticancel[type=to,target=0,lines=3,color=orange,centered]{f(x)-f(x)}$
\end{DemoCode}

Only a part of an equation can be cancelled, and the bars follow the size of the cancelled part:

\begin{DemoCode}{}
$x\tkzmulticancel[lines=2,centered]{y}$ \quad
$\displaystyle\frac%
{\tkzmulticancel[lines=3,color=red,centered]{(x+1)}}%
{\tkzmulticancel[lines=3,color=red,centered]{(x+1)}(x-2)}$ \quad
$e^{\tkzmulticancel[lines=2,centered]{2x}}$
\end{DemoCode}

\smallskip

Gaps, overshoot and arrow tip can be customized with keys.

\begin{DemoCode}{}
$\tkzmulticancel[lines=3,color=purple,sep=4pt]{x+y}$ \quad
$\tkzmulticancel[lines=3,centered,sep=2pt,extend=0pt]{x+y}$ \quad
$\tkzmulticancel[type=to,target=0,lines=2,color=red,arrow={-{Stealth[scale=1.2]}}]{a-a}$
\end{DemoCode}

The \TikZ{} style \texttt{tkzmulticancel line} is applied to every line, so it can be
appended (globally or in a group) to change the aspect of the lines.

\begin{DemoCode}{}
\tikzset{tkzmulticancel line/.append style={dashed,line width=1pt}}
$\tkzmulticancel[lines=2,color=purple]{x+y}$
\end{DemoCode}

The \texttt{<tikzpicture options>} are given to the \texttt{tikzpicture} containing the expression,
which is a node named \texttt{content}. They can also be used to change the style of the lines for
a single call, for example \texttt{<tkzmulticancel line/.append style=\{dashed\}>}.

\smallskip

Each cancellation is a small \texttt{tikzpicture}, so the compilation time increases with intensive use!

\pagebreak

\section{History}

\texttt{0.20c: Multicancel}

\texttt{0.20b: Bugfix with AtBeginDocument}

\texttt{0.20a: Pencircle effect}

\texttt{0.1.8: Pen-underline}

\texttt{0.1.7: AlphabetCubes}

\texttt{0.1.6: Thickness for 'freehand' circled text}

\texttt{0.1.5: Small 'freehand' circled text}

\texttt{0.1.4: Arrow with fitted text}

\texttt{0.1.3: Underline or surround effect}

\texttt{0.1.2: Comic bubble}

\texttt{0.1.1: Bicolor effect}

\texttt{0.1.0: Initial version}

\end{document}
