arabluatex.el 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. ;;; arabluatex.el --- AUCTeX style for `arabluatex.sty'
  2. ;; This file is part of the `arabluatex' package
  3. ;; ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX
  4. ;; Copyright (C) 2016--2020 Robert Alessi
  5. ;; The author would like to express his grateful thanks to Arash
  6. ;; Esbati <arash@gnu.org> whose comments helped to improve this file
  7. ;; immensely.
  8. ;; Please send error reports and suggestions for improvements to Robert
  9. ;; Alessi <alessi@robertalessi.net>
  10. ;; This program is free software: you can redistribute it and/or modify
  11. ;; it under the terms of the GNU General Public License as published by
  12. ;; the Free Software Foundation, either version 3 of the License, or
  13. ;; (at your option) any later version.
  14. ;; This program is distributed in the hope that it will be useful, but
  15. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. ;; General Public License for more details.
  18. ;; You should have received a copy of the GNU General Public License
  19. ;; along with this program. If not, see
  20. ;; <http://www.gnu.org/licenses/>.
  21. (defvar LaTeX-arabluatex-preamble-options
  22. '(("voc")
  23. ("fullvoc")
  24. ("novoc")
  25. ("trans")
  26. ("export" ("true" "false")))
  27. "Package options for the arabluatex package.")
  28. (defun LaTeX-arabluatex-package-options ()
  29. "Prompt for package options for arabluatex package."
  30. (TeX-read-key-val t LaTeX-arabluatex-preamble-options))
  31. (defvar LaTeX-arabluatex-mode-options
  32. '("voc"
  33. "fullvoc"
  34. "novoc"
  35. "trans")
  36. "List of local options for arabluatex macros.")
  37. (defvar LaTeX-arabluatex-key-val-options
  38. '(("mode" ("voc" "fullvoc" "novoc" "trans"))
  39. ("width")
  40. ("gutter")
  41. ("metre")
  42. ("color")
  43. ("delim" ("true" "false"))
  44. ("utf" ("true" "false"))
  45. ("export" ("true" "false")))
  46. "Key=value options for arabverse environment.")
  47. (defvar LaTeX-arabluatex-outfile-options
  48. '(("newline"))
  49. "List of options for outfile command.")
  50. (defvar LaTeX-arabluatex-arbmark-options
  51. '(("rl")
  52. ("lr"))
  53. "List of options for arbmark command.")
  54. (defvar LaTeX-arabluatex-arind-options
  55. '(("index")
  56. ("root"
  57. ("1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15"))
  58. ("form")
  59. ("pipe"))
  60. "Option for arind command.")
  61. (TeX-add-style-hook
  62. "arabluatex"
  63. (lambda ()
  64. ;; Run the style hook for loaded packages:
  65. (TeX-run-style-hooks "xcolor")
  66. ;; Folding features:
  67. (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list)
  68. '("[i]" ("arind")) t)
  69. ;; This package relies on lualatex, so check for it:
  70. (TeX-check-engine-add-engines 'luatex)
  71. (TeX-add-symbols
  72. "aemph"
  73. "SetInputScheme"
  74. '("SetArbEasy" 0)
  75. '("SetArbDflt" 0)
  76. '("SetArbEasy*" 0)
  77. '("SetArbDflt*" 0)
  78. "SetTranslitFont"
  79. "SetTranslitStyle"
  80. "SetTranslitConvention"
  81. "SetArbOutSuffix"
  82. "arbup"
  83. '("ArbUpDflt" 0)
  84. '("NoArbUp" 0)
  85. "SetArbUp"
  86. "uc"
  87. "prname"
  88. "txarb"
  89. '("arb" [ TeX-arg-eval completing-read
  90. (TeX-argument-prompt optional nil "Mode")
  91. LaTeX-arabluatex-mode-options ]
  92. t)
  93. '("arbcolor" [ TeX-arg-eval completing-read
  94. (TeX-argument-prompt optional nil "Color")
  95. (LaTeX-xcolor-definecolor-list) ]
  96. t)
  97. '("arbmark" [ TeX-arg-eval completing-read
  98. (TeX-argument-prompt optional nil "Option")
  99. LaTeX-arabluatex-arbmark-options ]
  100. t)
  101. '("ArbOutFile" [ TeX-arg-eval completing-read
  102. (TeX-argument-prompt optional nil "Option")
  103. LaTeX-arabluatex-outfile-options ]
  104. t)
  105. '("ArbOutFile*" [ TeX-arg-eval completing-read
  106. (TeX-argument-prompt optional nil "Option")
  107. LaTeX-arabluatex-outfile-options ]
  108. t)
  109. '("arind" [ TeX-arg-key-val LaTeX-arabluatex-arind-options ]
  110. TeX-arg-index)
  111. "SetHemistichDelim"
  112. '("bayt" 2)
  113. "abjad"
  114. "arbnull"
  115. "abraces"
  116. "LR"
  117. "RL"
  118. '("LRmarginpar" [ "Left margin text" ] "Text")
  119. '("LRfootnote"
  120. (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  121. t)
  122. '("RLfootnote"
  123. (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  124. t)
  125. "FixArbFtnmk"
  126. "MkArbBreak"
  127. '("newarbmark" 3)
  128. '("setRL" 0)
  129. '("setLR" 0))
  130. (LaTeX-add-environments
  131. '("arab" LaTeX-env-args
  132. [ TeX-arg-eval completing-read
  133. (TeX-argument-prompt optional nil "Mode")
  134. LaTeX-arabluatex-mode-options ]
  135. )
  136. "txarab"
  137. "arabexport"
  138. '("arabverse" LaTeX-env-args
  139. [ TeX-arg-key-val LaTeX-arabluatex-key-val-options ] ))
  140. ;; Fontification
  141. (when (and (featurep 'font-latex)
  142. (eq TeX-install-font-lock 'font-latex-setup))
  143. (font-latex-add-keywords '(("aemph" "{"))
  144. 'italic-command)
  145. (font-latex-add-keywords '(("LRmarginpar" "[{")
  146. ("LRfootnote" "[{")
  147. ("RLfootnote" "[{")
  148. ("arind" "[{"))
  149. 'reference)
  150. (font-latex-add-keywords '(("SetTranslitFont" "{")
  151. ("SetTranslitStyle" "{")
  152. ("SetTranslitConvention" "{"))
  153. 'function))
  154. ;; RefTeX support
  155. (when (fboundp 'reftex-add-index-macros)
  156. (reftex-add-index-macros '(("\\arind[]{*}" "" ?a "" nil t))))
  157. )
  158. LaTeX-dialect)
  159. ;;; arabluatex.el ends here