% Author.............: C. Pierquet
% licence............: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt

\NeedsTeXFormat{LaTeX2e}
\ProvidesExplPackage{customenvs-mathpictos}{2026/04/08}{0.1d}{Pictograms math}
%0.1d  New pictos
%0.1c  New pictos
%0.1b  New pictos
%0.1a  Initial version (LaTeX3)

%%=====Packages utiles et indispensables
\RequirePackage{graphicx}

%%=====Variables LaTeX3
\tl_new:N   \l__cemaththeme_bordures_tl
\tl_new:N   \l__cemaththeme_fondcouleur_tl
\int_new:N  \l__cemaththeme_pageoffset_int
\int_new:N  \l__cemaththeme_mainpage_int
\bool_new:N \l__cemaththeme_bg_bool
\bool_new:N \l__cemaththeme_rounded_bool

%%=====Clés avec l3keys
\keys_define:nn { cemaththeme }
{
  bordures         .tl_set:N    = \l__cemaththeme_bordures_tl,
  borders          .tl_set:N    = \l__cemaththeme_bordures_tl,
  bordures         .initial:n   = aucune,
  borders          .initial:n   = none,
  fond             .bool_set:N  = \l__cemaththeme_bg_bool,
  bg               .bool_set:N  = \l__cemaththeme_bg_bool,
  fond             .initial:n   = false,
  bg               .initial:n   = false,
  couleur~fond     .tl_set:N    = \l__cemaththeme_fondcouleur_tl,
  colback          .tl_set:N    = \l__cemaththeme_fondcouleur_tl,
  couleur~fond     .initial:n   = white,
  colback          .initial:n   = white,
  arrondi          .bool_set:N  = \l__cemaththeme_rounded_bool,
  round            .bool_set:N  = \l__cemaththeme_rounded_bool,
  arrondi          .initial:n   = false,
  round            .initial:n   = false
}

%%=====Fonction auxiliaire pour calculer l'offset
\cs_new:Npn \__cemaththeme_compute_offset:
{
  \str_case:VnF \l__cemaththeme_bordures_tl
  {
    { none }   { \int_set:Nn \l__cemaththeme_pageoffset_int { 4 } }
    { aucune } { \int_set:Nn \l__cemaththeme_pageoffset_int { 4 } }
    { 11 }     { \int_set:Nn \l__cemaththeme_pageoffset_int { 0 } }
    { 10 }     { \int_set:Nn \l__cemaththeme_pageoffset_int { 1 } }
    { 01 }     { \int_set:Nn \l__cemaththeme_pageoffset_int { 2 } }
    { 00 }     { \int_set:Nn \l__cemaththeme_pageoffset_int { 3 } }
  }
  { \int_set:Nn \l__cemaththeme_pageoffset_int { 0 } }
}
\cs_generate_variant:Nn \str_case:nnF { V }

%%=====Macro principale
\NewDocumentCommand \cemaththemeicon { O{height=1cm} m m }
{
  % #1 = options includegraphics
  % #2 = style (clés)
  % #3 = nom du pictogramme
  
  % Réinitialisation et traitement des clés
  \keys_set:nn { cemaththeme } { bordures = aucune , borders = none , fond = false , bg = false , couleur~fond = white , colback = white , round = false , arrondi = false}
  \keys_set:nn { cemaththeme } { #2 }
  
  % Calcul de l'offset
  \__cemaththeme_compute_offset:
  
  % Calcul de la page principale
  \str_case:enF { #3 }
  {
    %[fr]
    { binomiale }     { \int_set:Nn \l__cemaththeme_mainpage_int { 1 } }
    { convexite }     { \int_set:Nn \l__cemaththeme_mainpage_int { 6 } }
    { fctcube }       { \int_set:Nn \l__cemaththeme_mainpage_int { 11 } }
    { fctcarre }      { \int_set:Nn \l__cemaththeme_mainpage_int { 16 } }
    { variations }    { \int_set:Nn \l__cemaththeme_mainpage_int { 21 } }
    { probas }        { \int_set:Nn \l__cemaththeme_mainpage_int { 26 } }
    { nbderive }      { \int_set:Nn \l__cemaththeme_mainpage_int { 31 } }
    { ensembles }     { \int_set:Nn \l__cemaththeme_mainpage_int { 36 } }
    { lgn }           { \int_set:Nn \l__cemaththeme_mainpage_int { 41 } }
    { equadiff }      { \int_set:Nn \l__cemaththeme_mainpage_int { 46 } }
    { fcttrigo }      { \int_set:Nn \l__cemaththeme_mainpage_int { 51 } }
    { fctaffine }     { \int_set:Nn \l__cemaththeme_mainpage_int { 56 } }
    { integration }   { \int_set:Nn \l__cemaththeme_mainpage_int { 61 } }
    { intervalles }   { \int_set:Nn \l__cemaththeme_mainpage_int { 66 } }
    { limitesfct }    { \int_set:Nn \l__cemaththeme_mainpage_int { 71 } }
    { limitessuite }  { \int_set:Nn \l__cemaththeme_mainpage_int { 76 } }
    { calclitteral }  { \int_set:Nn \l__cemaththeme_mainpage_int { 81 } }
    { fctlog }        { \int_set:Nn \l__cemaththeme_mainpage_int { 86 } }
    { fctinv }        { \int_set:Nn \l__cemaththeme_mainpage_int { 91 } }
    { histogramme }   { \int_set:Nn \l__cemaththeme_mainpage_int { 96 } }
    { defsuites }     { \int_set:Nn \l__cemaththeme_mainpage_int { 101 } }
    { systemes }      { \int_set:Nn \l__cemaththeme_mainpage_int { 106 } }
    { chasles }       { \int_set:Nn \l__cemaththeme_mainpage_int { 111 } }
    { equations }     { \int_set:Nn \l__cemaththeme_mainpage_int { 116 } }
    { espace }        { \int_set:Nn \l__cemaththeme_mainpage_int { 121 } }
    { espaceproj }    { \int_set:Nn \l__cemaththeme_mainpage_int { 126 } }
    { pbgeom }        { \int_set:Nn \l__cemaththeme_mainpage_int { 131 } }
    { espacevect }    { \int_set:Nn \l__cemaththeme_mainpage_int { 136 } }
    { recurrence }    { \int_set:Nn \l__cemaththeme_mainpage_int { 141 } }
    { pourcentages }  { \int_set:Nn \l__cemaththeme_mainpage_int { 146 } }
    { fractions }     { \int_set:Nn \l__cemaththeme_mainpage_int { 151 } }
    { eqbarres }      { \int_set:Nn \l__cemaththeme_mainpage_int { 156 } }
    { scratch }       { \int_set:Nn \l__cemaththeme_mainpage_int { 161 } }
    { python }        { \int_set:Nn \l__cemaththeme_mainpage_int { 166 } }
    { tableur }       { \int_set:Nn \l__cemaththeme_mainpage_int { 171 } }
    { graphes }       { \int_set:Nn \l__cemaththeme_mainpage_int { 176 } }
    { arithm }        { \int_set:Nn \l__cemaththeme_mainpage_int { 181 } }
    { geogebra }      { \int_set:Nn \l__cemaththeme_mainpage_int { 186 } }
    { toilerecur }    { \int_set:Nn \l__cemaththeme_mainpage_int { 191 } }
    { cercletrigo }   { \int_set:Nn \l__cemaththeme_mainpage_int { 196 } }
    { pythagore }     { \int_set:Nn \l__cemaththeme_mainpage_int { 201 } }
    { thales }        { \int_set:Nn \l__cemaththeme_mainpage_int { 206 } }
    { outilsgeom }    { \int_set:Nn \l__cemaththeme_mainpage_int { 211 } }
    { numeration }    { \int_set:Nn \l__cemaththeme_mainpage_int { 216 } }
    { transfo }       { \int_set:Nn \l__cemaththeme_mainpage_int { 221 } }
    { applis }        { \int_set:Nn \l__cemaththeme_mainpage_int { 226 } }
    { booleen }       { \int_set:Nn \l__cemaththeme_mainpage_int { 231 } }
    { fctexpo }       { \int_set:Nn \l__cemaththeme_mainpage_int { 236 } }
    { pdtscal }       { \int_set:Nn \l__cemaththeme_mainpage_int { 241 } }
    { solide }        { \int_set:Nn \l__cemaththeme_mainpage_int { 246 } }
    { algo }          { \int_set:Nn \l__cemaththeme_mainpage_int { 251 } }
    { nwks }          { \int_set:Nn \l__cemaththeme_mainpage_int { 256 } }
    { gendarmes }     { \int_set:Nn \l__cemaththeme_mainpage_int { 261 } }
    { pixelart }      { \int_set:Nn \l__cemaththeme_mainpage_int { 266 } }
    { venn }          { \int_set:Nn \l__cemaththeme_mainpage_int { 271 } }
    { arbrebin }      { \int_set:Nn \l__cemaththeme_mainpage_int { 276 } }
    { matrices }      { \int_set:Nn \l__cemaththeme_mainpage_int { 281 } }
    { thmvalmoy }     { \int_set:Nn \l__cemaththeme_mainpage_int { 286 } }
    { pascal }        { \int_set:Nn \l__cemaththeme_mainpage_int { 291 } }
    { addposee }      { \int_set:Nn \l__cemaththeme_mainpage_int { 296 } }
    { arbrecalc }     { \int_set:Nn \l__cemaththeme_mainpage_int { 301 } }
    { sohcahtoa }     { \int_set:Nn \l__cemaththeme_mainpage_int { 306 } }
    { fibonnaci }     { \int_set:Nn \l__cemaththeme_mainpage_int { 311 } }
    { quatreops }     { \int_set:Nn \l__cemaththeme_mainpage_int { 316 } }
    { reglin }        { \int_set:Nn \l__cemaththeme_mainpage_int { 321 } }
    { moustaches }    { \int_set:Nn \l__cemaththeme_mainpage_int { 326 } }
    { fractale }      { \int_set:Nn \l__cemaththeme_mainpage_int { 331 } }
    { binaire }       { \int_set:Nn \l__cemaththeme_mainpage_int { 336 } }
    { patterns }      { \int_set:Nn \l__cemaththeme_mainpage_int { 341 } }
    { camembert }     { \int_set:Nn \l__cemaththeme_mainpage_int { 346 } }
    { arbreprobas }   { \int_set:Nn \l__cemaththeme_mainpage_int { 351 } }
    { complexes }     { \int_set:Nn \l__cemaththeme_mainpage_int { 356 } }
    { voisinage }     { \int_set:Nn \l__cemaththeme_mainpage_int { 361 } }
    { lectgraph }     { \int_set:Nn \l__cemaththeme_mainpage_int { 366 } }
    %[en]
    { binom }         { \int_set:Nn \l__cemaththeme_mainpage_int { 1 } }
    { convexity }     { \int_set:Nn \l__cemaththeme_mainpage_int { 6 } }
    { cubicfct }      { \int_set:Nn \l__cemaththeme_mainpage_int { 11 } }
    { quadfct }       { \int_set:Nn \l__cemaththeme_mainpage_int { 16 } }
    %{ variations }    { \int_set:Nn \l__cemaththeme_mainpage_int { 21 } }
    %{ probas }        { \int_set:Nn \l__cemaththeme_mainpage_int { 26 } }
    { derivnb }       { \int_set:Nn \l__cemaththeme_mainpage_int { 31 } }
    { sets }          { \int_set:Nn \l__cemaththeme_mainpage_int { 36 } }
    { lln }           { \int_set:Nn \l__cemaththeme_mainpage_int { 41 } }
    { diffeq }        { \int_set:Nn \l__cemaththeme_mainpage_int { 46 } }
    { trigfct }       { \int_set:Nn \l__cemaththeme_mainpage_int { 51 } }
    { affinfct }      { \int_set:Nn \l__cemaththeme_mainpage_int { 56 } }
    %{ integration }   { \int_set:Nn \l__cemaththeme_mainpage_int { 61 } }
    { intervals }     { \int_set:Nn \l__cemaththeme_mainpage_int { 66 } }
    { fctlim }        { \int_set:Nn \l__cemaththeme_mainpage_int { 71 } }
    { seqlim }        { \int_set:Nn \l__cemaththeme_mainpage_int { 76 } }
    { littcalc }      { \int_set:Nn \l__cemaththeme_mainpage_int { 81 } }
    { logfct }        { \int_set:Nn \l__cemaththeme_mainpage_int { 86 } }
    { invfct }        { \int_set:Nn \l__cemaththeme_mainpage_int { 91 } }
    { histogram }     { \int_set:Nn \l__cemaththeme_mainpage_int { 96 } }
    { seqdef }        { \int_set:Nn \l__cemaththeme_mainpage_int { 101 } }
    { systems }       { \int_set:Nn \l__cemaththeme_mainpage_int { 106 } }
    %{ chasles }       { \int_set:Nn \l__cemaththeme_mainpage_int { 111 } }
    %{ equations }     { \int_set:Nn \l__cemaththeme_mainpage_int { 116 } }
    { space }         { \int_set:Nn \l__cemaththeme_mainpage_int { 121 } }
    { projspac }      { \int_set:Nn \l__cemaththeme_mainpage_int { 126 } }
    { geompb }        { \int_set:Nn \l__cemaththeme_mainpage_int { 131 } }
    { vectspace }     { \int_set:Nn \l__cemaththeme_mainpage_int { 136 } }
    %{ recurrence }    { \int_set:Nn \l__cemaththeme_mainpage_int { 141 } }
    { percentages }   { \int_set:Nn \l__cemaththeme_mainpage_int { 146 } }
    %{ fractions }     { \int_set:Nn \l__cemaththeme_mainpage_int { 151 } }
    { bareq }         { \int_set:Nn \l__cemaththeme_mainpage_int { 156 } }
    %{ scratch }       { \int_set:Nn \l__cemaththeme_mainpage_int { 161 } }
    %{ python }        { \int_set:Nn \l__cemaththeme_mainpage_int { 166 } }
    { spreadsheet }   { \int_set:Nn \l__cemaththeme_mainpage_int { 171 } }
    { graphs }        { \int_set:Nn \l__cemaththeme_mainpage_int { 176 } }
    { arithmetic }    { \int_set:Nn \l__cemaththeme_mainpage_int { 181 } }
    %{ geogebra }      { \int_set:Nn \l__cemaththeme_mainpage_int { 186 } }
    { cabweb }        { \int_set:Nn \l__cemaththeme_mainpage_int { 191 } }
    { trigcircle }    { \int_set:Nn \l__cemaththeme_mainpage_int { 196 } }
    { pythagora }     { \int_set:Nn \l__cemaththeme_mainpage_int { 201 } }
    %{ thales }        { \int_set:Nn \l__cemaththeme_mainpage_int { 206 } }
    { geomtools }     { \int_set:Nn \l__cemaththeme_mainpage_int { 211 } }
    %{ numeration }    { \int_set:Nn \l__cemaththeme_mainpage_int { 216 } }
    { transform }     { \int_set:Nn \l__cemaththeme_mainpage_int { 221 } }
    { applications }  { \int_set:Nn \l__cemaththeme_mainpage_int { 226 } }
    { boolean }       { \int_set:Nn \l__cemaththeme_mainpage_int { 231 } }
    { expfct }        { \int_set:Nn \l__cemaththeme_mainpage_int { 236 } }
    { dotproduct }    { \int_set:Nn \l__cemaththeme_mainpage_int { 241 } }
    { solid }         { \int_set:Nn \l__cemaththeme_mainpage_int { 246 } }
    { algorithm }     { \int_set:Nn \l__cemaththeme_mainpage_int { 251 } }
    %{ nwks }          { \int_set:Nn \l__cemaththeme_mainpage_int { 256 } }
    { squeezethm }    { \int_set:Nn \l__cemaththeme_mainpage_int { 261 } }
    { pixlart }       { \int_set:Nn \l__cemaththeme_mainpage_int { 266 } }
    %{ venn }          { \int_set:Nn \l__cemaththeme_mainpage_int { 271 } }
    { bintree }       { \int_set:Nn \l__cemaththeme_mainpage_int { 276 } }
    { matrix }        { \int_set:Nn \l__cemaththeme_mainpage_int { 281 } }
    { meanvaluethm }  { \int_set:Nn \l__cemaththeme_mainpage_int { 286 } }
    %{ pascal }        { \int_set:Nn \l__cemaththeme_mainpage_int { 291 } }
    { arithmop }      { \int_set:Nn \l__cemaththeme_mainpage_int { 296 } }
    { bincalctree }   { \int_set:Nn \l__cemaththeme_mainpage_int { 301 } }
    %{ sohcahtoa }   { \int_set:Nn \l__cemaththeme_mainpage_int { 306 } }
    %{ fibonnaci }     { \int_set:Nn \l__cemaththeme_mainpage_int { 311 } }
    { fourops }       { \int_set:Nn \l__cemaththeme_mainpage_int { 316 } }
    { linreg }        { \int_set:Nn \l__cemaththeme_mainpage_int { 321 } }
    { boxplot }       { \int_set:Nn \l__cemaththeme_mainpage_int { 326 } }
    { fractal }       { \int_set:Nn \l__cemaththeme_mainpage_int { 331 } }
    { binary }        { \int_set:Nn \l__cemaththeme_mainpage_int { 336 } }
    %{ patterns }      { \int_set:Nn \l__cemaththeme_mainpage_int { 341 } }
    { chartpie }      { \int_set:Nn \l__cemaththeme_mainpage_int { 346 } }
    { probtree }      { \int_set:Nn \l__cemaththeme_mainpage_int { 351 } }
    { complex }       { \int_set:Nn \l__cemaththeme_mainpage_int { 356 } }
    { neighbour }     { \int_set:Nn \l__cemaththeme_mainpage_int { 361 } }
    { grapheq }       { \int_set:Nn \l__cemaththeme_mainpage_int { 366 } }
  }
  { \int_set:Nn \l__cemaththeme_mainpage_int { 1 } }
  
  % Insertion de l'image
  \bool_if:NTF \l__cemaththeme_bg_bool
    {
      {\setlength\fboxsep{0pt}\colorbox{\tl_use:N \l__cemaththeme_fondcouleur_tl}{\includegraphics[page = \int_eval:n { \l__cemaththeme_mainpage_int + \l__cemaththeme_pageoffset_int },#1]{ce-mathpictos-all.pdf}}}
    }
    {
      \bool_if:NTF \l__cemaththeme_rounded_bool
        {
          {\setlength\fboxsep{0pt}\cornersize{0.2}\ovalbox{\includegraphics[page = \int_eval:n { \l__cemaththeme_mainpage_int + \l__cemaththeme_pageoffset_int },#1]{ce-mathpictos-all.pdf}}}
        }
        {
          \includegraphics[page = \int_eval:n { \l__cemaththeme_mainpage_int + \l__cemaththeme_pageoffset_int },#1]{ce-mathpictos-all.pdf}
        }
    }
}

\endinput