arabluatex.el 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. ;;; arabluatex.el --- AUCTeX style for `arabluatex.sty'
  2. ;; This file is part of the `arabluatex' package
  3. ;; arabluatex -- ArabTeX for LuaLaTeX
  4. ;; Copyright (C) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023
  5. ;; Robert Alessi <alessi@robertalessi.net>
  6. ;; Permission to use, copy, modify, and distribute this software for
  7. ;; any purpose with or without fee is hereby granted, provided that
  8. ;; the above copyright notice and this permission notice appear in all
  9. ;; copies.
  10. ;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. ;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. ;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. ;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
  14. ;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  15. ;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  16. ;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  17. ;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. ;; The author would like to express his grateful thanks to Arash
  19. ;; Esbati <arash@gnu.org> whose comments helped to improve this file
  20. ;; immensely.
  21. ;; Please send error reports and suggestions for improvements to Robert
  22. ;; Alessi <alessi@robertalessi.net>
  23. (defvar LaTeX-arabluatex-preamble-options
  24. '(("voc")
  25. ("fullvoc")
  26. ("novoc")
  27. ("trans")
  28. ("export" ("true" "false")))
  29. "Package options for the arabluatex package.")
  30. (defun LaTeX-arabluatex-package-options ()
  31. "Prompt for package options for arabluatex package."
  32. (TeX-read-key-val t LaTeX-arabluatex-preamble-options))
  33. (defvar LaTeX-arabluatex-mode-options
  34. '(("voc")
  35. ("fullvoc")
  36. ("novoc")
  37. ("trans"))
  38. "List of local options for arabluatex macros.")
  39. (defvar LaTeX-arabluatex-key-val-options
  40. '(("mode" ("voc" "fullvoc" "novoc" "trans"))
  41. ("width")
  42. ("gutter")
  43. ("metre")
  44. ("color")
  45. ("delim" ("true" "false"))
  46. ("utf" ("true" "false"))
  47. ("export" ("true" "false")))
  48. "Key=value options for arabverse environment.")
  49. (defvar LaTeX-arabluatex-outfile-options
  50. '(("newline"))
  51. "List of options for outfile command.")
  52. (defvar LaTeX-arabluatex-arbmark-options
  53. '(("rl")
  54. ("lr"))
  55. "List of options for arbmark command.")
  56. (defvar LaTeX-arabluatex-arind-options
  57. '(("index")
  58. ("root"
  59. ("1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15"))
  60. ("form")
  61. ("pipe"))
  62. "Option for arind command.")
  63. (TeX-add-style-hook
  64. "arabluatex"
  65. (lambda ()
  66. ;; Run the style hook for loaded packages:
  67. (TeX-run-style-hooks "xcolor")
  68. ;; Folding features:
  69. (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list)
  70. '("[i]" ("arind")) t)
  71. ;; This package relies on lualatex, so check for it:
  72. (TeX-check-engine-add-engines 'luatex)
  73. (TeX-add-symbols
  74. "aemph"
  75. "SetInputScheme"
  76. '("SetArbEasy" 0)
  77. '("SetArbDflt" 0)
  78. '("SetArbEasy*" 0)
  79. '("SetArbDflt*" 0)
  80. "SetTranslitFont"
  81. "SetTranslitStyle"
  82. "SetTranslitConvention"
  83. "SetArbOutSuffix"
  84. "arbup"
  85. '("ArbUpDflt" 0)
  86. '("NoArbUp" 0)
  87. "SetArbUp"
  88. "uc"
  89. "prname"
  90. "txarb"
  91. '("arb" [ TeX-arg-eval completing-read
  92. (TeX-argument-prompt nil nil "Mode")
  93. LaTeX-arabluatex-mode-options ]
  94. t)
  95. '("arbcolor" [ TeX-arg-eval completing-read
  96. (TeX-argument-prompt nil nil "Color")
  97. (LaTeX-xcolor-definecolor-list) ]
  98. t)
  99. '("arbmark" [ TeX-arg-eval completing-read
  100. (TeX-argument-prompt nil nil "Option")
  101. LaTeX-arabluatex-arbmark-options ]
  102. t)
  103. '("ArbOutFile" [ TeX-arg-eval completing-read
  104. (TeX-argument-prompt nil nil "Option")
  105. LaTeX-arabluatex-outfile-options ]
  106. t)
  107. '("ArbOutFile*" [ TeX-arg-eval completing-read
  108. (TeX-argument-prompt nil nil "Option")
  109. LaTeX-arabluatex-outfile-options ]
  110. t)
  111. '("arind" [ TeX-arg-key-val LaTeX-arabluatex-arind-options ]
  112. TeX-arg-index)
  113. "SetHemistichDelim"
  114. '("bayt" 2)
  115. '("bayt+" 2)
  116. "abjad"
  117. '("SetArbNumbers" "Indian or Arabic")
  118. "arbnull"
  119. "abraces"
  120. "LR"
  121. "RL"
  122. '("LRmarginpar" [ "Left margin text" ] "Text")
  123. '("LRfootnote"
  124. (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  125. t)
  126. '("RLfootnote"
  127. (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  128. t)
  129. "FixArbFtnmk"
  130. "MkArbBreak"
  131. '("newarbmark" 3)
  132. '("setRL" 0)
  133. '("setLR" 0))
  134. (LaTeX-add-environments
  135. '("arab" LaTeX-env-args
  136. [ TeX-arg-eval completing-read
  137. (TeX-argument-prompt nil nil "Mode")
  138. LaTeX-arabluatex-mode-options ]
  139. )
  140. "txarab"
  141. "arabexport"
  142. '("arabverse" LaTeX-env-args
  143. [ TeX-arg-key-val LaTeX-arabluatex-key-val-options ] ))
  144. ;; Fontification
  145. (when (and (featurep 'font-latex)
  146. (eq TeX-install-font-lock 'font-latex-setup))
  147. (font-latex-add-keywords '(("aemph" "{"))
  148. 'italic-command)
  149. (font-latex-add-keywords '(("LRmarginpar" "[{")
  150. ("LRfootnote" "[{")
  151. ("RLfootnote" "[{")
  152. ("arind" "[{"))
  153. 'reference)
  154. (font-latex-add-keywords '(("SetTranslitFont" "{")
  155. ("SetTranslitStyle" "{")
  156. ("SetTranslitConvention" "{"))
  157. 'function))
  158. ;; RefTeX support
  159. (when (fboundp 'reftex-add-index-macros)
  160. (reftex-add-index-macros '(("\\arind[]{*}" "" ?a "" nil t))))
  161. )
  162. LaTeX-dialect)
  163. ;;; arabluatex.el ends here