Font Catalogue

The \LaTeX font catalogue is a listing of a wide variety of fonts with examples. Let's explore how to use those fonts in Reanimate.

Fetamont

Go to https://tug.org/FontCatalogue/fetamont/ and look under the Usage section. There you can find \LaTeX preamble code and style selector code. The preamble looks like this:

\usepackage{fetamont}
\usepackage[T1]{fontenc}

And the style selector looks like this: \ffmfamily

Armed with this information, we can create a TeX configuration in Reanimate:

fetamont = TexConfig LaTeX
  ["\\usepackage{fetamont}"
  ,"\\usepackage[T1]{fontenc}"]
  ["\\ffmfamily"]

animation :: Animation
animation = scene $
  showCfg "Fetamont" fetamont

showCfg :: T.Text -> TexConfig -> Scene s ()
showCfg name cfg = do
  let title = scale 2 $ center $
        latexCfg cfg name
      line1 = center $ latexCfg cfg
        "Pack My Box"
      line2 = center $ latexCfg cfg
        "With Five Dozen"
      line3 = center $ latexCfg cfg
        "Liquour Jugs"

  header <- oNew title
  oModify header $
    oTopY .~ screenTop
  oShow header

  l1 <- oNew line1
  l1 `oBelow` header
  oShow l1

  l2 <- oNew line2
  l2 `oBelow` l1
  oShow l2

  l3 <- oNew line3
  l3 `oBelow` l2
  oShow l3
  wait 1

oBelow a b = do
  aBot <- oRead b oBottomY
  oModifyS a $ do
    oMarginTop .= 0
    oTopY .= aBot


Inconsolata

Configuration code for Inconsolata can be found here: https://tug.org/FontCatalogue/inconsolata/

inconsolata = TexConfig LaTeX
  ["\\usepackage{inconsolata}"
  ,"\\renewcommand*\\familydefault{\\ttdefault}"
  ,"\\usepackage[T1]{fontenc}"]
  ["\\normalfont"]

animation :: Animation
animation = scene $
  showCfg "Inconsolata" inconsolata

showCfg :: T.Text -> TexConfig -> Scene s ()
showCfg name cfg = do
  let title = scale 2 $ center $
        latexCfg cfg name
      line1 = center $ latexCfg cfg
        "Pack My Box"
      line2 = center $ latexCfg cfg
        "With Five Dozen"
      line3 = center $ latexCfg cfg
        "Liquour Jugs"

  header <- oNew title
  oModify header $
    oTopY .~ screenTop
  oShow header

  l1 <- oNew line1
  l1 `oBelow` header
  oShow l1

  l2 <- oNew line2
  l2 `oBelow` l1
  oShow l2

  l3 <- oNew line3
  l3 `oBelow` l2
  oShow l3
  wait 1

oBelow a b = do
  aBot <- oRead b oBottomY
  oModifyS a $ do
    oMarginTop .= 0
    oTopY .= aBot


Computer Modern

Computer modern is the default font. It's presented here as a reference and as a point of comparison.

-- Default font so no need to do anything.
computerModern = TexConfig LaTeX
  []
  []

animation :: Animation
animation = scene $
  showCfg "Computer Modern" computerModern

showCfg :: T.Text -> TexConfig -> Scene s ()
showCfg name cfg = do
  let title = scale 2 $ center $
        latexCfg cfg name
      line1 = center $ latexCfg cfg
        "Pack My Box"
      line2 = center $ latexCfg cfg
        "With Five Dozen"
      line3 = center $ latexCfg cfg
        "Liquour Jugs"

  header <- oNew title
  oModify header $
    oTopY .~ screenTop
  oShow header

  l1 <- oNew line1
  l1 `oBelow` header
  oShow l1

  l2 <- oNew line2
  l2 `oBelow` l1
  oShow l2

  l3 <- oNew line3
  l3 `oBelow` l2
  oShow l3
  wait 1

oBelow a b = do
  aBot <- oRead b oBottomY
  oModifyS a $ do
    oMarginTop .= 0
    oTopY .= aBot


Missing fonts

Fonts only work if they are installed in your TeX setup. If a font is missing, you'll get a cryptic error message like this:

clayTablet = TexConfig LaTeX
  ["\\usepackage{fontspec}"
  ,"\\setmainfont{QTClaytablet}"]
  ["\\normalfont"]

animation :: Animation
animation = scene $
  showCfg "Claytablet" clayTablet

showCfg :: T.Text -> TexConfig -> Scene s ()
showCfg name cfg = do
  let title = scale 2 $ center $
        latexCfg cfg name
      line1 = center $ latexCfg cfg
        "Pack My Box"
      line2 = center $ latexCfg cfg
        "With Five Dozen"
      line3 = center $ latexCfg cfg
        "Liquour Jugs"

  header <- oNew title
  oModify header $
    oTopY .~ screenTop
  oShow header

  l1 <- oNew line1
  l1 `oBelow` header
  oShow l1

  l2 <- oNew line2
  l2 `oBelow` l1
  oShow l2

  l3 <- oNew line3
  l3 `oBelow` l2
  oShow l3
  wait 1

oBelow a b = do
  aBot <- oRead b oBottomY
  oModifyS a $ do
    oMarginTop .= 0
    oTopY .= aBot