macros.texi 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. @c Various useful Texinfo macros.
  2. @c I'm no expert at Texinfo, so these macro definitions are probably
  3. @c done the Wrong Way, defining a default & undefining it for every
  4. @c output format specialization. But it works, and it works a lot more
  5. @c simply than other methods I considered.
  6. @c --------------------
  7. @c @suba{alphabetic-subscript}
  8. @c Format an alphabetic subscript. In output formats that will
  9. @c really write a subscript, this just uses @sub; others, however,
  10. @c have hyphens preceding them to look nicer.
  11. @macro suba{t}
  12. --@sub{\t\}
  13. @end macro
  14. @iftex
  15. @unmacro suba
  16. @macro suba{t}
  17. @sub{\t\}
  18. @end macro
  19. @end iftex
  20. @ifhtml
  21. @unmacro suba
  22. @macro suba{t}
  23. @sub{\t\}
  24. @end macro
  25. @end ifhtml
  26. @c --------------------
  27. @c @returns{}
  28. @c Display an arrow, signifying a function's codomain. Arrows can be
  29. @c prettier in TeX. (I tried the arrow entities in HTML, but they're
  30. @c all ugly.)
  31. @macro returns{}
  32. -->
  33. @end macro
  34. @iftex
  35. @unmacro returns
  36. @macro returns{}
  37. @inlineraw{tex, $\\longrightarrow$}
  38. @end macro
  39. @end iftex
  40. @c --------------------
  41. @c @subtype{}
  42. @c Generate an arrow that signifies a subtype relation. In non-TeX
  43. @c output, this is just a simple double-shafted arrow; in TeX, this
  44. @c displays as a lattice relation.
  45. @macro subtype{}
  46. <=
  47. @end macro
  48. @iftex
  49. @unmacro subtype
  50. @macro subtype{}
  51. @inlineraw{tex, $\\sqsubseteq$}
  52. @end macro
  53. @end iftex
  54. @c --------------------
  55. @c @embedref{node, text}
  56. @c Cross-reference \node\ with hotlink text of \text\; if we're using
  57. @c TeX as an output format, this should use \text\ and subsequently
  58. @c parenthetically refer to \node\, because TeX ignores the text of
  59. @c the regular @ref{node, text}, making it rather hard to read.
  60. @macro embedref{node, text}
  61. @ref{\node\, \text\}
  62. @end macro
  63. @ifinfo
  64. @unmacro embedref
  65. @macro embedref{node, text}
  66. \text\ (@pxref{\node\})
  67. @end macro
  68. @end ifinfo
  69. @iftex
  70. @unmacro embedref
  71. @macro embedref{node, text}
  72. \text\ (@pxref{\node\})
  73. @end macro
  74. @end iftex
  75. @c --------------------
  76. @c @urlref{url, text}
  77. @c In HTML output, the same as @uref; in other output, generates both
  78. @c the text and URL explicitly. (Why @uref doesn't do this in TeX
  79. @c output is beyond me.)
  80. @iftex
  81. @macro urlref{url, text}
  82. \text\ (@url{\url\})
  83. @end macro
  84. @end iftex
  85. @ifnottex
  86. @macro urlref{url, text}
  87. \text\ (@url{\url\})
  88. @end macro
  89. @end ifnottex
  90. @c --------------------
  91. @c @tabledfn{fn, args, rettype}
  92. @c Like @defun &c., but for table entries, and with return type
  93. @c generation built-in.
  94. @macro tabledfn{fn, args, rettype}
  95. \fn\ \args\ @returns{} \rettype\
  96. @end macro
  97. @iftex
  98. @unmacro tabledfn
  99. @macro tabledfn{fn, args, rettype}
  100. @dfn{@strong{\fn\} \args\ @returns{} \rettype\}
  101. @end macro
  102. @end iftex
  103. @ifhtml
  104. @unmacro tabledfn
  105. @macro tabledfn{fn, args, rettype}
  106. @strong{\fn\} @emph{\args\ @returns{} \rettype\}
  107. @end macro
  108. @end ifhtml
  109. @c --------------------
  110. @c @texonlyindent{}
  111. @c The same as @noindent except in TeX output, where it has no effect.
  112. @c This is for the beginning of sections that have parenthesized
  113. @c parts that shouldn't qualify as the first paragraph, i.e. shouldn't
  114. @c cause the next one to be indented. (Why is the first paragraph of
  115. @c a section indented in TeX anyway? It shouldn't be at all!)
  116. @iftex
  117. @macro texonlyindent{}
  118. @end macro
  119. @end iftex
  120. @ifnottex
  121. @macro texonlyindent{}
  122. @noindent
  123. @end macro
  124. @end ifnottex
  125. @c --------------------
  126. @c @ie{}, @eg{}, @Eg{}, @etc{}, @etcT{}, @etal{}
  127. @c Commands to insert Latin abbreviations, with italicization,
  128. @c canonical abbreviated forms (&c. vs etc. vs et cetera), and
  129. @c correct sentence termination.
  130. @macro ie{}
  131. @i{i.e.@:}
  132. @end macro
  133. @macro eg{}
  134. @i{e.g.@:}
  135. @end macro
  136. @macro Eg{}
  137. @i{E.g.@:}
  138. @end macro
  139. @macro etc{}
  140. @i{&c.@:}
  141. @end macro
  142. @c No trailing period is included here so that the surrounding text
  143. @c will look clearer: this is intended at the end of a sentence. (The
  144. @c T stands for 'terminal.')
  145. @macro etcT{}
  146. @i{&c}
  147. @end macro
  148. @macro etal{}
  149. @i{et al.}
  150. @end macro