  
  [1X2 [33X[0;0YLaTeX Generation[133X[101X
  
  
  [1X2.1 [33X[0;0YLaTeX Generation Functions for GAP Objects[133X[101X
  
  [33X[0;0YThe  introduction  in  [14X1.1[114X  describes  a  powerful framework created in this
  package  allowing  for  a  standardised  methodology to generate typesetting
  strings via the semantic features of objects.[133X
  
  [33X[0;0YThis  section  describes  the  implementation  of  the  framework for LaTeX,
  providing  both  the  invaluable  functionality  to  typeset a subset of [5XGAP[105X
  objects  as  LaTeX  strings  whilst  also  serving  as an example of how the
  framework can be used for other typesetting languages.[133X
  
  [33X[0;0YIt  also  provides  some  insight  into the kinds of functions that would be
  expected  from  an  implementation  for  a  different language. A bare-boned
  example implementation for MathML is provided in [14X4[114X.[133X
  
  [33X[0;0YCurrently,  the  following  types  have explicit methods installed for LaTeX
  generation:[133X
  
  [30X    [33X[0;6YRationals (Integers and Fractions)[133X
  
  [30X    [33X[0;6YInfinity and Negative Infinity[133X
  
  [30X    [33X[0;6YInternal Finite-Field Elements[133X
  
  [30X    [33X[0;6YPermutations[133X
  
  [30X    [33X[0;6YLists[133X
  
  [30X    [33X[0;6YMatrices[133X
  
  [30X    [33X[0;6YPolynomials and Non-Polynomial Rational Functions[133X
  
  [30X    [33X[0;6YCharacter Tables[133X
  
  [30X    [33X[0;6YGenerators for FP, PC, Matrix and Permutation Groups[133X
  
  [30X    [33X[0;6YAssociative Words in Letter Representation[133X
  
  [33X[0;0YIt  should  also  be  noted  that  [2XTypeset[102X ([14X1.1-2[114X) does fallback to the core
  library  function  [2XViewString[102X ([14XReference: ViewString[114X), which can be used for
  any types which do not require LaTeX-specific formatting to be renderable in
  math mode (e.g. floats).[133X
  
  [1X2.1-1 GenLatexTmpl[101X
  
  [33X[1;0Y[29X[2XGenLatexTmpl[102X( [3Xobj[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YAn Unpopulated LaTeX Format String[133X
  
  [33X[0;0YGenerates  a  format string that represents the structural definition of the
  given  [5XGAP[105X  object  [3Xobj[103X  in LaTeX. It contains no parameter values, and will
  need  to be populated with the arguments representing the semantic values of
  the  object,  generated  via [2XGenArgs[102X ([14X1.2-1[114X), before it can be rendered in a
  LaTeX environment.[133X
  
  [1X2.1-2 CtblEntryLatex[101X
  
  [33X[1;0Y[29X[2XCtblEntryLatex[102X( [3Xs[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA String[133X
  
  [33X[0;0YFormats  a  string representation of an entry [3Xs[103X returned by the undocumented
  function     [10XCharacterTableDisplayStringEntryDefault[110X    to    include    the
  LaTeX-specific bar environment for complex conjugates.[133X
  
  [1X2.1-3 CtblLegendLatex[101X
  
  [33X[1;0Y[29X[2XCtblLegendLatex[102X( [3Xdata[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA String[133X
  
  [33X[0;0YGenerates  a  string  representation of the mathematical substitutions [3Xdata[103X,
  generated           by           the          undocumented          function
  [10XCharacterTableDisplayStringEntryDataDefault[110X  for  entries within a character
  table.[133X
  
  [1X2.1-4 GenNameAssocLetterLatex[101X
  
  [33X[1;0Y[29X[2XGenNameAssocLetterLatex[102X( [3Xs[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA String[133X
  
  [33X[0;0YGenerates  a string representation of the provided letter string [3Xs[103X correctly
  subscripted with a LaTeX math-mode subscript environment.[133X
  
  [1X2.1-5 FactoriseAssocWordLatex[101X
  
  [33X[1;0Y[29X[2XFactoriseAssocWordLatex[102X( [3Xl[103X, [3Xnames[103X, [3Xtseed[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA Factorised String[133X
  
  [33X[0;0YFactorises   the   string   representation   of  an  assoc  word  in  letter
  representation  [3Xl[103X,  based on the return value from the undocumented function
  [10XFindSubstringPowers[110X,  using  the passed list of letters [3Xnames[103X, and a list of
  reserved numbers [3Xtseed[103X (typically empty for initial calls).[133X
  
  [33X[0;0YThis  method  is  essentially  a  LaTeX-specific  implementation  of the the
  undocumented function [10XNiceStringAssocWord[110X.[133X
  
  
  [1X2.2 [33X[0;0YRendering LaTeX Strings[133X[101X
  
  [33X[0;0YTo  aid  users using [2XTypeset[102X ([14X1.1-2[114X), being able to view the results quickly
  in  a  variety of widely-used formats would help streamline the usage of the
  package. As such, a number of functions described below have been written to
  enable  users  to  render  the output LaTeX-renderable snippets in different
  fashions.[133X
  
  [1X2.2-1 RenderLatex[101X
  
  [33X[1;0Y[29X[2XRenderLatex[102X( [3Xstr[103X[, [3Xoptions[103X] ) [32X function[133X
  
  [33X[0;0YRenders  a given LaTeX string [3Xstr[103X in a LaTeX environment, providing a visual
  example  of  what  the  string  would look like in a paper. By default, this
  involved  creating a HTML file that includes the MathJax script, but the [5XGAP[105X
  option [3Xoutput[103X can be passed to change the rendering method.[133X
  
  [33X[0;0YCurrently implemented rendering methods are:[133X
  
  [30X    [33X[0;6Y[10X"mathjax"[110X, calling [2XMathJax[102X ([14X2.2-3[114X)[133X
  
  [30X    [33X[0;6Y[10X"pdflatex"[110X, calling [2XPDFLatex[102X ([14X2.2-2[114X)[133X
  
  [30X    [33X[0;6Y[10X"overleaf"[110X, calling [2XOverleaf[102X ([14X2.2-4[114X)[133X
  
  [33X[0;0YThese  functions  can  be  called independently of [2XRenderLatex[102X, which serves
  only to be a more centralised rendering method for users.[133X
  
  [1X2.2-2 PDFLatex[101X
  
  [33X[1;0Y[29X[2XPDFLatex[102X( [3Xstr[103X ) [32X function[133X
  
  [33X[0;0YRenders  a  given  LaTeX  string [3Xstr[103X in a new PDF file, specifically via the
  pdflatex bash tool.[133X
  
  [1X2.2-3 MathJax[101X
  
  [33X[1;0Y[29X[2XMathJax[102X( [3Xstr[103X ) [32X function[133X
  
  [33X[0;0YRenders  a  given LaTeX string [3Xstr[103X in a HTML file, making use of the MathJax
  and TikzJax scripts.[133X
  
  [1X2.2-4 Overleaf[101X
  
  [33X[1;0Y[29X[2XOverleaf[102X( [3Xstr[103X ) [32X function[133X
  
  [33X[0;0YRenders a given LaTeX string [3Xstr[103X in a new Overleaf project, specifically via
  a URL-encoded snippet.[133X
  
  [1X2.2-5 URIEncodeComponent[101X
  
  [33X[1;0Y[29X[2XURIEncodeComponent[102X( [3Xraw[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA Percent-Encoded String[133X
  
  [33X[0;0YReplaces reserved characters within a URI component [3Xraw[103X as per RFC-3986.[133X
  
  [1X2.2-6 NeedsLatexMathMode[101X
  
  [33X[1;0Y[29X[2XNeedsLatexMathMode[102X( [3Xraw[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA Boolean[133X
  
  [33X[0;0YDetermines  if  the  LaTeX  snippet  [3Xraw[103X  requires  LaTeX's  math mode to be
  rendered correctly.[133X
  
  [1X2.2-7 DEFAULT_LATEX_PREAMBLE[101X
  
  [33X[1;0Y[29X[2XDEFAULT_LATEX_PREAMBLE[102X [32X global variable[133X
  
  [33X[0;0YDefault  LaTeX  preamble string used for creating compilable [10X.tex[110X files from
  LaTeX snippets.[133X
  
  [1X2.2-8 DEFAULT_MATHJAX_TAGS[101X
  
  [33X[1;0Y[29X[2XDEFAULT_MATHJAX_TAGS[102X [32X global variable[133X
  
  [33X[0;0YDefault  HTML document and head tags used to create HTML files using MathJax
  to render LaTeX snippets.[133X
  
  [1X2.2-9 ALWAYS_UNESCAPED_CHARS[101X
  
  [33X[1;0Y[29X[2XALWAYS_UNESCAPED_CHARS[102X [32X global variable[133X
  
  [33X[0;0YString   containing   all   of  the  characters  that  do  not  need  to  be
  percent-encoded within URI components, as per RFC-3986.[133X
  
  
  [1X2.3 [33X[0;0YDigraphs Integration[133X[101X
  
  [33X[0;0Y[5Xdigraphs[105X   is   a   powerful,  widely-used  packages,  implementing  helpful
  functionality  to  work  with  directed graphs amongst other objects. Due to
  it's  popularity,  and as a way to demonstrate how [5Xtypeset[105X can be integrated
  with  external  packages,  the  following functions have been implemented to
  allow directed graphs to be converted into LaTeX representations.[133X
  
  [33X[0;0YIt  should be noted that the conversion implemented here does use the output
  from  [2XDotDigraph[102X  ([14XDigraphs:  DotDigraph[114X),  which  generates  the DOT string
  representing  a  digraph.  This  is then used to either convert it to a tikz
  representation  via  the  command-line  tool  dot2tex  (using the [5XGAP[105X option
  [10XdigraphOut  := "dot2tex"[110X), or simply wrapping it up in a dot2tex environment
  provided  by  the  LaTeX package dot2texi which will compile the wrapped DOT
  input into tikz during compilation of the LaTeX file itself.[133X
  
  [33X[0;0YWhile another method could be written to convert the internal representation
  of  a  directed  graph  directly  into  a  tikzpicture, this would likely be
  incredibly  convoluted and difficult, and may present numerous problems with
  edge  positioning.  Therefore,  relying  on  dot2tex  was chosen as the best
  approach.[133X
  
  [1X2.3-1 DEFAULT_DOT2TEX_OPTIONS[101X
  
  [33X[1;0Y[29X[2XDEFAULT_DOT2TEX_OPTIONS[102X [32X global variable[133X
  
  [33X[0;0YDefault command-line options passed to the [10Xdot2tex[110X executable to convert dot
  strings.[133X
  
  [1X2.3-2 Dot2Tex[101X
  
  [33X[1;0Y[29X[2XDot2Tex[102X( [3Xobj[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA Tikz String[133X
  
  [33X[0;0YExecutes [10Xdot2tex[110X on the dot string representing a given digraph object [3Xobj[103X.[133X
  
