article-luaxelatex.tex 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. \documentclass{article}
  2. % Support for Agda code.
  3. \usepackage{agda}
  4. % Use special font families without TeX ligatures for Agda code. (This
  5. % code is inspired by a comment by Enrico Gregorio/egreg:
  6. % https://tex.stackexchange.com/a/103078.)
  7. \usepackage{fontspec}
  8. \newfontfamily{\AgdaSerifFont}{Latin Modern Roman}
  9. \newfontfamily{\AgdaSansSerifFont}{Latin Modern Sans}
  10. \newfontfamily{\AgdaTypewriterFont}{Latin Modern Mono}
  11. \renewcommand{\AgdaFontStyle}[1]{{\AgdaSansSerifFont{}#1}}
  12. \renewcommand{\AgdaKeywordFontStyle}[1]{{\AgdaSansSerifFont{}#1}}
  13. \renewcommand{\AgdaStringFontStyle}[1]{{\AgdaTypewriterFont{}#1}}
  14. \renewcommand{\AgdaCommentFontStyle}[1]{{\AgdaTypewriterFont{}#1}}
  15. \renewcommand{\AgdaBoundFontStyle}[1]{\textit{\AgdaSerifFont{}#1}}
  16. % Workarounds for the fact that the Latin Modern Sans font does not
  17. % support certain characters. An alternative would be to use another
  18. % font.
  19. \usepackage{newunicodechar}
  20. \newunicodechar{λ}{\ensuremath{\mathnormal{\lambda}}}
  21. \newunicodechar{∀}{\ensuremath{\mathnormal{\forall}}}
  22. \newunicodechar{₁}{\ensuremath{{}_1}}
  23. \begin{document}
  24. Some code:
  25. \begin{code}%
  26. \>[0]\AgdaSymbol{\{-\#}\AgdaSpace{}%
  27. \AgdaKeyword{OPTIONS}\AgdaSpace{}%
  28. \AgdaPragma{--without-K}\AgdaSpace{}%
  29. \AgdaPragma{--count-clusters}\AgdaSpace{}%
  30. \AgdaSymbol{\#-\}}\<%
  31. \\
  32. %
  33. \\[\AgdaEmptyExtraSkip]%
  34. \>[0]\AgdaKeyword{open}\AgdaSpace{}%
  35. \AgdaKeyword{import}\AgdaSpace{}%
  36. \AgdaModule{Agda.Builtin.String}\<%
  37. \\
  38. %
  39. \\[\AgdaEmptyExtraSkip]%
  40. \>[0]\AgdaComment{--\ A\ comment\ with\ some\ TeX\ ligatures:}\<%
  41. \\
  42. \>[0]\AgdaComment{--\ --,\ ---,\ ?`,\ !`,\ `,\ ``,\ ',\ '',\ <<,\ >>.}\<%
  43. \\
  44. %
  45. \\[\AgdaEmptyExtraSkip]%
  46. \>[0]\AgdaFunction{Θ₁}\AgdaSpace{}%
  47. \AgdaSymbol{:}\AgdaSpace{}%
  48. \AgdaPrimitive{Set}\AgdaSpace{}%
  49. \AgdaSymbol{→}\AgdaSpace{}%
  50. \AgdaPrimitive{Set}\<%
  51. \\
  52. \>[0]\AgdaFunction{Θ₁}\AgdaSpace{}%
  53. \AgdaSymbol{=}\AgdaSpace{}%
  54. \AgdaSymbol{λ}\AgdaSpace{}%
  55. \AgdaBound{A}\AgdaSpace{}%
  56. \AgdaSymbol{→}\AgdaSpace{}%
  57. \AgdaBound{A}\<%
  58. \\
  59. %
  60. \\[\AgdaEmptyExtraSkip]%
  61. \>[0]\AgdaFunction{a-name-with--hyphens}\AgdaSpace{}%
  62. \AgdaSymbol{:}\AgdaSpace{}%
  63. \AgdaSymbol{∀}\AgdaSpace{}%
  64. \AgdaSymbol{\{}\AgdaBound{A}\AgdaSpace{}%
  65. \AgdaSymbol{:}\AgdaSpace{}%
  66. \AgdaPrimitive{Set}\AgdaSymbol{\}}\AgdaSpace{}%
  67. \AgdaSymbol{→}\AgdaSpace{}%
  68. \AgdaBound{A}\AgdaSpace{}%
  69. \AgdaSymbol{→}\AgdaSpace{}%
  70. \AgdaBound{A}\<%
  71. \\
  72. \>[0]\AgdaFunction{a-name-with--hyphens}\AgdaSpace{}%
  73. \AgdaBound{ff--fl}\AgdaSpace{}%
  74. \AgdaSymbol{=}\AgdaSpace{}%
  75. \AgdaBound{ff--fl}\<%
  76. \\
  77. %
  78. \\[\AgdaEmptyExtraSkip]%
  79. \>[0]\AgdaFunction{ffi}\AgdaSpace{}%
  80. \AgdaSymbol{:}\AgdaSpace{}%
  81. \AgdaPostulate{String}\<%
  82. \\
  83. \>[0]\AgdaFunction{ffi}\AgdaSpace{}%
  84. \AgdaSymbol{=}\AgdaSpace{}%
  85. \AgdaString{"--"}\<%
  86. \end{code}
  87. Note that the code is indented.
  88. \end{document}