REDUCETypesetMaths.html 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="author" content="Francis Wright" />
  6. <title>REDUCE Typeset Mathematics Display</title>
  7. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css"
  8. integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous" />
  9. <!-- The loading of KaTeX is deferred to speed up page rendering -->
  10. <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"
  11. integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
  12. <!-- To automatically render math in text elements, include the auto-render extension: -->
  13. <script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"
  14. integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
  15. onload="renderMathInElement(document.body);"></script>
  16. <style>
  17. body {
  18. font-family: "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
  19. font-size: 12pt;
  20. max-width: 640px;
  21. margin-right: auto;
  22. margin-left: auto;
  23. }
  24. code {
  25. font-family: "Lucida Console", "Lucida Sans Typewriter", monospace;
  26. }
  27. h1, h2, h3 {
  28. font-family: "Lucida Bright", Georgia, Times, "Times New Roman", serif;
  29. }
  30. table {
  31. margin-right: auto;
  32. margin-left: auto;
  33. }
  34. td, th {
  35. padding-right: 10px;
  36. padding-left: 10px;
  37. text-align: left;
  38. }
  39. </style>
  40. </head>
  41. <body>
  42. <h1>REDUCE Typeset Mathematics Display</h1>
  43. <h2>Francis Wright, October 2020</h2>
  44. <p>
  45. This is an attempt to document the options that are readily
  46. available to users for controlling the <code>tmprint</code>
  47. package, which is used internally by the CSL REDUCE GUI and the
  48. REDUCE TeXmacs interface to generate TeX markup for typeset
  49. maths display. Closely related code is used for the same
  50. purpose by Run-REDUCE.
  51. </p>
  52. <h3>Enable and disable</h3>
  53. <p>
  54. Typeset maths display can be turned on and off using the
  55. switch <code>fancy</code>, so <code>on fancy</code> turns it on
  56. (the default) and <code>off fancy</code> turns it off. (But do
  57. not do this in Run-REDUCE; use the <em>Typeset Maths</em> check
  58. item in the <em>View</em> menu.)
  59. </p>
  60. <h3>Derivatives</h3>
  61. <p>
  62. The (shared) variable <code>fancy_print_df</code> can be set to
  63. one of the values <code>partial</code>, <code>total</code>
  64. or <code>indexed</code> to control the display of derivatives.
  65. The default value is <code>partial</code>. From REDUCE revision
  66. 5418 onward, typeset maths supports the <code>dfprint</code>
  67. switch, and if this switch is on then
  68. <code>fancy_print_df</code> is ignored. For example, with the
  69. following settings, derivatives are displayed as follows
  70. (assuming <code>depend f,x,y</code> and <code>operator
  71. g</code>):
  72. </p>
  73. <table>
  74. <tr>
  75. <th><code>Setting</code></th>
  76. <th><code>df(f,x,2,y)</code></th>
  77. <th><code>df(g(x,y),x,2,y)</code></th>
  78. </tr>
  79. <tr>
  80. <td><code>fancy_print_df := partial</code></td>
  81. <td>\(\frac{\partial^3 f}{\partial x^2 \partial y}\)</td>
  82. <td>\(\frac{\partial^3 g(x,y)}{\partial x^2 \partial y}\)</td>
  83. </tr>
  84. <tr>
  85. <td><code>fancy_print_df := total</code></td>
  86. <td>\(\frac{d^3 f}{d x^2 d y}\)</td>
  87. <td>\(\frac{d^3 g(x,y)}{d x^2 d y}\)</td>
  88. </tr>
  89. <tr>
  90. <td><code>fancy_print_df := indexed</code></td>
  91. <td>\(f_{x,x,y}\)</td>
  92. <td>\(g(x,y)_{x,x,y}\)</td>
  93. </tr>
  94. <tr>
  95. <td><code>on dfprint</code></td>
  96. <td>\(f_{x,x,y}\)</td>
  97. <td>\(g_{x,x,y}\)</td>
  98. </tr>
  99. </table>
  100. <h3>Operators</h3>
  101. <p>
  102. An operator declared <code>print_indexed</code> has its
  103. arguments displayed as indices, e.g. after <code>print_indexed
  104. a;</code> the operator value <code>a(i,2)</code> is displayed as
  105. \(a_{i,2}\). You can also declare several operators together to
  106. be indexed, e.g.
  107. </p>
  108. <pre>print_indexed b, c;</pre>
  109. <p>
  110. (In REDUCE versions before revision 5417 the display of indexed
  111. operators is slightly different and possibly incorrect, and
  112. parentheses are required around multiple arguments of
  113. <code>print_indexed</code>)
  114. </p>
  115. <h3>Digits in identifiers</h3>
  116. <p>
  117. The (shared) variable <code>fancy_lower_digits</code> can be set
  118. to one of the values <code>t</code>, <code>nil</code>
  119. or <code>all</code> to control the display of digits within
  120. identifiers. The default value is <code>t</code>. Digits in an
  121. identifier are typeset as subscripts if <code>fancy_lower_digits
  122. = all</code> or if <code>fancy_lower_digits = t</code> and the
  123. digits are all at the end. For example, with the following
  124. values assigned
  125. to <code>fancy_lower_digits</code>, <code>ab12cd34</code>
  126. and <code>abcd34</code> are displayed as follows:
  127. </p>
  128. <table>
  129. <tr>
  130. <th><code>fancy_lower_digits</code></th>
  131. <th><code>ab12cd34</code></th>
  132. <th><code>abcd34</code></th>
  133. </tr>
  134. <tr>
  135. <td><code>t</code></td>
  136. <td>\(ab12cd34\)</td>
  137. <td>\(abcd_{34}\)</td>
  138. </tr>
  139. <tr>
  140. <td><code>all</code></td>
  141. <td>\(ab_{12}cd_{34}\)</td>
  142. <td>\(abcd_{34}\)</td>
  143. </tr>
  144. <tr>
  145. <td><code>nil</code></td>
  146. <td>\(ab12cd34\)</td>
  147. <td>\(abcd34\)</td>
  148. </tr>
  149. </table>
  150. <p>
  151. (However, CSL REDUCE currently displays identifiers with more
  152. than one letter in roman rather than italic font style, and
  153. Run-REDUCE currently displays implicit subscript digits in
  154. italic rather than normal font style, but I hope to have that
  155. fixed soon!)
  156. </p>
  157. </body>
  158. </html>