%This file contains all the macros used
%in the LaTeX port of the document cheat.pdf available
%in the TeX showcase.


%This boolean is true when output is DVI and false otherwise
\newtoggle{DVIOutput}
\togglefalse{DVIOutput}
\ifx\pdfoutput\@undefined
  % no pdfTeX
  \togglefalse{DVIOutput}
\else\ifnum\pdfoutput<1
  %pdfTeX is outputting a .dvi file
  \toggletrue{DVIOutput}
\else
  %pdfTeX is outputting a .pdf file
  \togglefalse{DVIOutput}
\fi\fi

%These lengths are used to specify the dimentions of the different columns
%of the tabular environment. These are useful to write code working on many
%page after the specific dimentions for the page have been assigned to them.
%Normally no page of the document has more than three columns even
%the page 2 but for the ease of typesetting it is useful
%to split the first logical column in three. Thus it is
%possible to have until 5 columns.
\newlength{\ColOne}
\newlength{\ColTwo}
\newlength{\ColThree}
\newlength{\ColFour}
\newlength{\ColFive}
%Theses length are mainly used to save the current similar
%values which can be locally modified.
\newlength{\BeforeFormulaSpace} % Will contain the space before a formula when it is displayed.
\newlength{\InterFormulaSpace} %Space between two lines of formulae displayed
                                 %inside the 'DisplayFormulae' environment
\newlength{\DisLeftSkip}
\newlength{\DisParFillSkip}
\newlength{\DisParIndent}
%The length '\CurrentLineWidth' is the current width of a line. 
%It is useful when a lot of data (like when writing 
%formulae with "\Fm" macros) should be put on a line to 
%know when inserting a break.
%
%This variable is mainly used in the macro "\LongEquation"
%and "\Fm" which have to put a maximum amount of text on a line.
\newlength{\CurrentLineWidth} 
%The length \MathContentSize is used to setup the size of the parboxes
%containing the different mathematical elements of the page
\newlength{\MathContentSize}
%This length is useful to manipulate horizontal space
\newlength{\HSpace}
%This length is useful to manipulate vertical space at different
%place
\newlength{\VSpace}
%This is a temporary length usable for computation inside macro
\newlength{\TmpLengthA}

%A temporary counter for a local usage
\newcounter{tmpCountA}
%A counter used to contain the number of blank lines
%to add in a table from the 'nicematrix' package.
\newcounter{NbBlankLines}
%Some new counters are usefuls to number equations and formulaes
%The counter 'DisplayFormulaNb' is the number of the current displayed formulae
\newcounter{DisplayFormulaNb}
%The enumerated type describing the style to display the number
%of the formulae. The values are:
%    0  without number
%    1  regular
%    2  bold
\chardef\StyleWithoutNumber=0
\chardef\StyleRegular=1
\chardef\StyleBold=2
\chardef\DisNumberStyle=\StyleWithoutNumber
%Enumerated type to indicate if the formula should be typeset
%in display style (with bigger characters) or without change
\chardef\SmallChar=1
\chardef\BigChar=0
\chardef\DisDisplay=\BigChar

%This box is useful to store a formula which can
%be moved after composition.
\newsavebox\FormulaBox

%Three temporary boxes (for use in a macro)
\newsavebox\TmpBoxA
\newsavebox\TmpBoxB
\newsavebox\TmpBoxC
%This box contains the Escher's impossible brick on page 10
\newsavebox\ImpossibleBrick

%------------------------------------------------------------------------------
%
%                                   Macros definition
%
%------------------------------------------------------------------------------

%This TeX (and not LaTeX) macro does nothing but it can be used
%inside other macro to achieve some effects. It is declared here just
%to be certain that the name will be unique.
\def\cheatTmpMacro{\relax}

%This command define the separator of thousands (this one is different in differents
%regions/country)
\newcommand\SepMillier{\,}
%Similary the decimal separator is different in different country.
\newcommand\SepDecimal{{,}} 

%The following macros modify the space typeset by LaTeX before and after
%a formula in display math.
%
%The command has two parameter
%     1) the new space to use in normal mode (symmetric for above and below)
%     2) the new space to use for short mode (the mode is short when
%        the line of text before is shorter than the width of formula).
\newcommand\DisplaySpace[2]{%
       \deflength{\abovedisplayskip}{#1}%
       \deflength{\belowdisplayskip}{#1}%
       \deflength{\abovedisplayshortskip}{#2}%
       \deflength{\belowdisplayshortskip}{#2}%
}
 
%Define a new environment useful to typeset formulae in a more or less free
%style.
%
%This environment has 5 parameters:
%     1) The number to use when displaying the first formula
%        (generally 1 except when a sequence of formula should
%         be continued)
%     2) The horizontal space to let before a formula.
%     3) The dimention which should separate two formulae
%     4) An enumerated value to define the style of displaying
%        the formula (standard mode, display mode etc.)
%     5) An enumerated type to specify the style (bold, regular...) of the number of the
%        formula.
\newenvironment{DisplayFormulae}[5]{%Begin definitions
   \newbool{FirstFormula}%
   \booltrue{FirstFormula}%
   \newbool{PrintEquation}% true if the formula should be typeset 
                          % and printed, when fals it is only typeset
                          % (useful to know its width)
   \booltrue{PrintEquation}%
   \newbool{Inline}%When true, the formula is not typeset in a box
                   %but simply typed inline. Rarely used but useful
                   %if the formula is surrounded by some text.
   \boolfalse{Inline}%
   \deflength\CurrentLineWidth{0pt}%
   \defcounter{DisplayFormulaNb}{#1}%
   % Since this counter is automatically incremented before
   % to typeset a formula
   \defcounter{DisplayFormulaNb}{\value{DisplayFormulaNb}-1}%
   \deflength{\BeforeFormulaSpace}{#2}%
   \deflength{\InterFormulaSpace}{#3}%
   \chardef\DisDisplay=#4%
   \chardef\DisNumberStyle=#5%
   \deflength{\DisLeftSkip}{\leftskip}%
   \deflength{\DisParFillSkip}{\parfillskip}%
   \deflength{\DisParIndent}{\parindent}%
   \deflength{\parindent}{0pt}%
   \deflength{\leftskip}{0pt}% 
   \deflength{\parfillskip}{0pt}%
   \par\unskip
   \begin{sloppypar}\raggedright\noindent\unskip
}{%End definitions 
  \par\end{sloppypar}\noindent
  \setlength{\leftskip}{\DisLeftSkip}%
  \setlength{\parfillskip}{\DisParFillSkip}%
}

%This macro put a new line when writing formulae with the
%\Fm family of macro inside an environment 'DisplayFormulae'
%The macro has one parameter
%    1)The height to force at the begining of a paragraph
%      This forces an interline with a rule. This parameter
%      is optionnal and its default value is '\InterFormulaSpace'
%
%This macro uses the global (to itself) length
%'\CurrentLineWidth'
\newcommand\NewParFormulae[1][\InterFormulaSpace]{%
    \par
    %To force the desired space between formulae
    \rule{0pt}{#1}%
    \unskip\noindent\unskip}

%This macro is the separator of formulae. Normally
%it is empty but it can be redefined to set a specific
%separator if needed.
%
%This macro is executed in math mode
\newcommand\FmSep{\relax}

%This macro is used to display a formula inside an environment
%"DisplayFormulae". It will work correctly only in that
%environement which provide a way to use global variables (to this
%macro) to keep some states between its different calls. 
%
%It has two parameters:
%     1) A boolean value which, when it is true, indicates
%        that the formula should be printed inline
%        with some other text (but the formula is still
%        typeset in LR box). For this to work correctly,
%        it is sufficient that the length '\CurrentLineWidth'
%        being set to a length of 0pt. This is like the
%        first equation on a line and the equation is simply
%        printed without adding anything.
%        This parameter is optionnal and its default value is 'false'.
%     2) The formula to display. The formula
%        is typeset in math mode.
%
%This macro uses and update the global (to the macro) 
%length "\CurrentLineWidth" (which indicate the next point
%where to put text on the current line).
%
%The global variable (defined inside the
%'DisplayFormulae' environment) '\DisNumberStyle' is used too,
%to determine how the equation should be typeset (with or without
%numbering for instance).
%
%!! Be careful !!
%When not in inline mode, this macro skips all the blanks 
%before it. This is useful to avoid spurious blanks introduced
%somewhere before the call to this macro.
\newcommand\Fm[2][false]{%
    \setbool{Inline}{#1}%
    \ifbool{Inline}{\deflength{\CurrentLineWidth}{0pt}}{%
         %Not Inline:
         \unskip\noindent\unskip
    }%
    \defcounter{DisplayFormulaNb}{\value{DisplayFormulaNb}+1}%
    \WriteFormula{\the\CurrentLineWidth}{\CurrentLineWidth}{#2}{true}%
    %Since a formula is written, we are no more on the first formula.
    \boolfalse{FirstFormula}%
}%

%This command do really the job of typesetting the formula
%It has 5 parameters:
%      1) A white space to be put before the equation.
%         If this value is greater than 0pt, the equation is
%         considered to be part of a multipart equation
%         (but it is not its first part). 
%
%         This means that a space of that dimention is simply added
%         before the equation and the equation is printed.
%         If the width of the text with the added space before
%         the equation is wider than the available space, the equation
%         is simply typeset right justified. 
%
%         This parameter is optionnal and its value is 0pt.
%      2) The current position on the line
%      3) A variable of type dimen to contain the new
%         point of insertion in the printed line (where
%         the next equation could be typesetted).
%      4) The formula to type
%      5) A boolean value which when it is true indicates that
%         the equation should be printed. Otherwise the equation
%         is typesetted but not printed. This is useful to
%         know the width of the printed equation, but without
%         printing it in the text.
\newcommand\WriteFormula[5][0pt]{%
    \begingroup%To protect the global boxes and variables used
               %in this macro.
       \deflength{\CurrentLineWidth}{#2}%The current position on the line
       \setbool{PrintEquation}{#5}%
       \ifdimequal{#1}{0pt}%
       {%Normal case when one has to print a std equation
          \ifdimgreater{\CurrentLineWidth}{0pt}{%Already some text on the line
             %we add the space between the formula.
             \ifbool{PrintEquation}{%
                \hspace{\InterFormulaeSkip}%
                \deflength{\CurrentLineWidth}{\CurrentLineWidth+\InterFormulaeSkip}%
             }{}%
          }{}%
          \savebox\FormulaBox{%
                \hspace*{\BeforeFormulaSpace}%
                \ifnum\DisNumberStyle=\StyleBold
                   \textbf{\arabic{DisplayFormulaNb}.~}%
                \else
                   \ifnum\DisNumberStyle=\StyleRegular
                      \arabic{DisplayFormulaNb}.~%
                   \fi
                \fi
                \ensuremath{%
                   \ifnum\DisDisplay=\BigChar\displaystyle\fi
                   %Typeset the equation and call the macro to 
                   %add a separator between the equations.
                   #4\FmSep}%
          }%
          \settowidth{\HSpace}{\usebox\FormulaBox}%
          \deflength\CurrentLineWidth{\CurrentLineWidth+\HSpace}%
          \ifdimgreater{\CurrentLineWidth}{\linewidth}%
          {%Force a new paragraph
                \ifbool{PrintEquation}{\NewParFormulae}{}%
                \deflength{\CurrentLineWidth}{\HSpace}%Since the formula is the only text on the line
          }{}%
       }{%The second part of the equation should be printed
           \savebox\FormulaBox{%
                 \ensuremath{%
                    \ifnum\DisDisplay=\BigChar\displaystyle\fi
                     %Typeset the second part of the equation
                     %but add the white space before it. 
                     \makebox[#1][l]{}#4\FmSep\relax
                 }%
           }%
           \settowidth{\HSpace}{\usebox\FormulaBox}%
           \deflength{\CurrentLineWidth}{\HSpace}%
           \ifdimgreater{\CurrentLineWidth}{\linewidth}%
           {%With the space added before it,
            %the second part of the equation is wider
            %than the available space. We simply put
            %the equation right aligned
              \savebox\FormulaBox{%
                 \makebox[\linewidth][l]{%
                   \ensuremath{%
                      \ifnum\DisDisplay=\BigChar\displaystyle\fi
                      %Typeset the second part of the equation without
                      %the preceding blank space and force the right alignment
                      \hfill #4\FmSep\relax
                   }%
                 }%
              }%
              \settowidth{\HSpace}{\usebox\FormulaBox}%
              %Since the line is pushed to the right of space, the line
              %is full.
              \deflength{\CurrentLineWidth}{\linewidth}%
           }{}%
       }%
       \ifbool{PrintEquation}{\usebox\FormulaBox}{}%Print the formula in the document 
       %\HSpace is the width of the box containing the typeseted formula.
       \ifdimgreater{\HSpace}{\linewidth}%
       {\typeout{^^J==Info The text of this equation:^^J#4^^J%
                      is wider than the width of the text. Please split it manually.}%
       }{}%
       \edef\mytemp{\endgroup
            \noexpand\deflength{#3}{\the\CurrentLineWidth}%
       }%
    \mytemp %Close the group and set the value of the
            %insertion point of the next equation.
}

%The following macro is similar to '\Fm' but write only
%the first part of an equation. When an equation is spiltted in two parts,
%the first part starts always on a new line (except if this is
%the first equation of a group of equations, to avoid extra blank
%space).
%
%The macro has one parameter:
%       1) The first part of the equation
%          The formula is typeset in math mode.
\newcommand\FmPartA[1]{%
   \begingroup
      %A group can be used since this command should always be used
      %with '\FmPartB' and the fact that the \CurrentLineWidth is not
      %updated (due to the group) is without importance since the next
      %text will be the second part of the equation on a new line.

      %Force equation on a new line except if this is the first equation.
       \ifbool{FirstFormula}{%First formula
       }{%No more the first formula, a new line is forced
           \NewParFormulae%
        }%
      \deflength{\CurrentLineWidth}{0pt}%Since this equation starts 
                                        %on a new line
      %There must be no separator of equation between the two part of
      %a splitted equation
      \def\FmSep{\relax}%
      \Fm{#1}%
   \endgroup
}

%The following macro is similar to '\Fm' but write only
%the second part of an equation
%
%The macro has two parameters:
%       1) Some text which will be used to determine the horizontal
%          offset to let before writing the second part of the equation
%       2) The second part of the equation
%The formulae are typeset in math mode.
\newcommand\FmPartB[2]{%
   %Start on a new line.
   \NewParFormulae
   %Typeset the first part of the equation without printing it
   %to get the length of the first part in \TmpLengthA
   \WriteFormula{0pt}{\TmpLengthA}{#1}{false}%
   %Print the second (or following) part of the equation by
   %adding a blank space corresponding to the width of the
   %first part. The parameter with a length of 0pt
   %reflects the fact that the equation start at the beginning
   %of the line (after the \NewParFormulae}.
   \WriteFormula[\TmpLengthA]{0pt}{\CurrentLineWidth}{#2}{true}%
   %A blank character seems to be present, it is suppressed
   %now
   \unskip
}

%This macro is useful to indicate that no specific typeseting
%should be done (and the default typesetting should be used instead)
\newcommand\DoNothing{}

%This macro is made to display the long equations (where 2 equal signs are used
%to separate part of equation)
%The macro has 5 parameters
%     1) Any parameter expanding to something prevents
%        the addition of space before equation. Otherwise
%        a space of "\SpaceBeforeLongEq" is added
%     2) The formula until the first equal sign
%     3) The formula beteween the two equal sign
%     4) The formula after the last equal sign
%     5) The width of the line where the long equation should be typeset.
%
%If for some reason there is less than 2 equal signs, the corresponding 
%parameters should be empty.
%
%This macro uses the global boxes "\TmpBoxA" and \TmpBoxB".
%This macro uses the global length "\CurrentLineWidth" and "\HSpace"
%
\newcommand\LongEquation[5][{\DoNothing}]{%
  \begingroup
     \deflength{\CurrentLineWidth}{#5}%
     \par
     \ifdefempty{#1}{\AdjustSpace{\SpaceBeforeLongEq}}{}%
     \noindent
     \def\temp{#3}%
     \ifx\temp\empty
       %Second parameter empty, the first part of equation is simply printed.
       $#2$%
     \else
       %Second parameter not empty 
       \savebox\TmpBoxA{$#2=#3$}%
       \settowidth\HSpace{\usebox\TmpBoxA}%
       \ifnum\HSpace>\CurrentLineWidth
          $#2=$\\\mbox{}\hfill
          \savebox\TmpBoxA{$#3$}%
       \fi
       \def\temp{#4}%
       \ifx\temp\empty
          %Third parameter empty the formula until this parameter is typeset
          \usebox\TmpBoxA
       \else
          %Third parameter not empty
          \savebox\TmpBoxB{$#2=#3=#4$}%
          \settowidth{\HSpace}{\usebox\TmpBoxB}%
          \ifnum\HSpace>\CurrentLineWidth
             \usebox\TmpBoxA=\\\mbox{}\hfill
             $#4$% 
          \else
             \usebox\TmpBoxB
          \fi
       \fi
     \fi
  \endgroup
}


%This command add or remove vertical space
%
%The command has 1 parameter
%   1) The length for the space to add or remove
\newcommand\AdjustSpace[1]{\par %to force vertical mode
                           \vspace{#1}\noindent\ignorespaces\par}

%This command assign a counter with the biggest of three numbers.
%
%The macro has 4parameters:
%       1) The name of the resulting counter.
%          This parameter is optionnal and its name is 
%          'NbBlankLines'
%       2-4) The three values to check
\newcommand\BiggestNbLines[4][NbBlankLines]{%
    \defcounter{#1}{#2}%The biggest is the first
    \ifnumless{\value{#1}}{#3}{%first < second
            %The biggest is the second number
            \defcounter{#1}{#3}%
        }{}
    \ifnumless{\value{#1}}{#4}{%The current biggest < third
          %the biggest is the third number
            \defcounter{#1}{#4}%
         }{}
}

%This command adds few blank lines in a table. It is particularly useful
%with the 'nicematrix' package where it is often necessary to add few lines
%to be able to use block on many lines.
%
%The macro has two parameters:
%           1) The number of lines to add
%           2) A macro to add the lines
%
%This command uses the global counter 'NbBlankLines' and the macro
%'\cheatTmpMacro'.
\newcommand\AddBlankLines[2]{%
       \defcounter{NbBlankLines}{#1}%
       \def\cheatTmpMacro{\relax}%
       \whileboolexpr{test {\ifnumcomp{\value{NbBlankLines}}{>}{0}}}%
                     {\defcounter{NbBlankLines}{\value{NbBlankLines}-1}%
                      \edef\cheatTmpMacro{\cheatTmpMacro #2}}%
       \cheatTmpMacro
}

%This command is used to setup the style of the numerous
%small titles used in the page.
%
%The command has one parameter
%         1) The text of the intertitle
\newcommand\IntertitleShape[1]{%
     \textit{#1}%
}

%This command add some remarks about a math formula.
%It is very useful to add some text like "a>0"
%
%The macro has two parameters
%        1) The separator to typeset before the remark. This parameter
%           is optionnal and has the value of '\text{,}\enspace'
%        2) The text of the remark, which will be typeset
%           in math mode. One has to use the AMS command
%           '\text' to typeset in text mode
\newcommand\MathRemark[2][\text{,}\enspace]{\unskip\ensuremath{#1#2}}

%This command add the infinitesimal difference after a math expression
%It is very useful to have consistent spacing
%before the 'dx'.
%The command has one parameter:
%     1) The letter to use. This parameter is typeset
%        in math mode and it is optionnal. Its
%        default value is 'x'
\newcommand\dx[1][x]{\unskip\ensuremath{\,d#1}}

%This command is used to typeset a variable followed
%by the infinitesimal difference dx
%
%This command has one parameter
%        1) The letter to use for the variable.
%           This text is typeset in math mode This parameter
%           is optional and its value is 'x'
\newcommand\xdx[1][x]{\ensuremath{#1\dx}}

%
%This command is intended to stack two characters
%with some vertical space between them. 
%
%The command has 4 parameters:
%    1) a left delimiter (might be empty)
%    2) a right delimiter (might be empty)
%    3) the "numerator" character
%    4) the "denominator" character 
%
%The idea is taken from here:
%https://tex.stackexchange.com/questions/119096/on-atop-again-how-to-obtain-the-same-result-without-warning
%
%The syntax of \genfrac macro is:
%\genfrac{<left-delim>}{<right-delim>}{<thickness>}{<mathstyle>}{<numerator>}{<denominator>}
\newcommand\Empile[4]{%
    \genfrac{#1}{#2}{\z@}{}{#3}{#4}%
}
 
%Macros defined in the original document
\newcommand\titleTable{\textbf{\rule[-2ex]{0pt}{6ex}\large Mathematical formulæ and facts}}
\newcommand\Real{\iftutex\BbbR\else\mathbb{R}\fi} %ℝ
\newcommand\Natural{\iftutex\BbbN\else\mathbb{N}\fi} %ℕ
\newcommand\Z{\iftutex\BbbZ\else\mathbb{Z}\fi} %ℤ
\newcommand\Par{\par\vskip 3pt}
\newcommand\centertwo[2]{\line {\hss #1\hss #2\hss}}
\newcommand\centerthree[3]{\line {\hss #1\hss #2\hss #3\hss}}
\newcommand\sign{\hbox{\rm sign}}
\newcommand\etc{$\ldots$}
\newcommand\Ldots{,\ldots,}
\newcommand\Hrule{\vskip 3pt\hrule\vskip 3pt}
\newcommand\Or{\vee}
\newcommand\E{\iftutex\BbbE\else\mathbb{E}\fi} %Expectation (in probabilities)
\newcommand\abs{\mathop{\rm abs}\nolimits}
\newcommand\perm{\mathop{\rm perm}\nolimits}
\newcommand\sech{\mathop{\rm sech}\nolimits}
\newcommand\csch{\mathop{\rm csch}\nolimits}

\newcommand\arccot{\mathop{\rm arccot}\nolimits}
\newcommand\arcsec{\mathop{\rm arcsec}\nolimits}
\newcommand\arccsc{\mathop{\rm arccsc}\nolimits}
\newcommand\arcsinh{\mathop{\rm arcsinh}\nolimits}
\newcommand\arccosh{\mathop{\rm arccosh}\nolimits}
\newcommand\arctanh{\mathop{\rm arctanh}\nolimits}
\newcommand\arccoth{\mathop{\rm arccoth}\nolimits}
\newcommand\arcsech{\mathop{\rm arcsech}\nolimits}
\newcommand\arccsch{\mathop{\rm arccsch}\nolimits}

\iftutex %16bits TeX   
        %lAngle,rAngle are defined in unicode-math
        \newcommand\Euls[2]{\ensuremath{\Empile{\lAngle}{\rAngle}{#1}{#2}}}
        %but not in Lucida
        \ifnum\PoliceDocument=\PoliceLucida
             \renewcommand\Euls[2]{\bigg\langle\!\!\!\bigg\langle{#1 \atop #2} \bigg\rangle\!\!\!\bigg\rangle}
        %and dejavusans
        \else
            \ifnum\PoliceDocument=\PoliceDejavuSans
               \renewcommand\Euls[2]{\bigg\langle\!\!\!\bigg\langle{#1 \atop #2} \bigg\rangle\!\!\!\bigg\rangle}
            \fi
        \fi
\else %8 bits TeX.
      %Use of the TeX definition.
        \newcommand\Euls[2]{\bigg\langle\!\!\!\bigg\langle{#1 \atop #2} \bigg\rangle\!\!\!\bigg\rangle}
\fi
\newcommand\ramsey{\mathop{\rm r}\nolimits}
\newcommand\Var{\mathop{\rm Var}\nolimits} %variance (prob and stat)
\newcommand\SousEnsemble[2]{\ensuremath{\Empile{\{}{\}}{#1}{#2}}}
\newcommand\Cycle[2]{\cycle{#1}{#2}}
\newcommand\cycle[2]{\ensuremath{\Empile{[}{]}{#1}{#2}}}
\newcommand\Eul[2]{\eul{#1}{#2}}
\newcommand\eul[2]{\ensuremath{\Empile{\langle}{\rangle}{#1}{#2}}}
\newcommand\fivrm{}
\newcommand\euls[2]{\Euls{#1}{#2}}
\newcommand\ValAbs[1]{\lvert#1\rvert} %absolute value

%Commands used to make the title page. 
%This document could be typeset many times with each time a different
%font. Then each produced document will be merged into one. 
%This is useful to show a large set of fonts.
%
%In this latter case, it is important to be able to deactivate
%some parts of the title which will be otherwise redundant.
\newbool{FullTitle}
\booltrue{FullTitle}%When true all the title is typeset, otherwise
                    %only the name of the used font is displayed

%The font to use for the name of the package (this font should be adapted,
%if possible, to a very big character used a title).
\newcommand\TitleFontFile{QTHelvet-BoldOutline.otf}
\IfFontExistsTF{\TitleFontFile}%
  {\newfontface\PackageNameFnt{\TitleFontFile}}{\newcommand\PackageNameFnt{\relax}}
%This command typeset the main title and the full name of the package
%The command has no parameter
\newcommand\PackageName{%
   \ifbool{FullTitle}%
   {%
     \par\centerline{\PackageNameFnt\fontsize{50pt}{55pt}\selectfont MathTrip}\par
   }{}%
}
%A short quote to go with the package name (and the main title)
\newcommand\TitleQuote{%
   \ifbool{FullTitle}%
   {%
      \begin{flushright}%
           \parbox[t]{20em}{%
               %\fontsize{20pt}{24pt}\selectfont
               La pente, déjà verticale, se redressait encore.
               \par
               %\fontsize{16pt}{18pt}\selectfont\itshape
               \textit{\small The slope, already vertical, was still rising.}
               \begin{flushright}
                   Georges Livanos (french alpinist)
               \end{flushright}%
           }%
      \end{flushright}%
   }{}%
}

%The version of the document
\newcommand\Version{2.8}
