"Fossies" - the Fresh Open Source Software Archive

Member "auctex-12.3/style/bidi.el" (18 Oct 2020, 5456 Bytes) of package /linux/misc/auctex-12.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Lisp source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "bidi.el": 12.2_vs_12.3.

    1 ;;; bidi.el --- AUCTeX style for the (XeLaTeX) bidi package
    2 
    3 ;; Copyright (C) 2016--2020 Free Software Foundation, Inc.
    4 
    5 ;; Author: Uwe Brauer <oub@mat.ucm.es>
    6 ;; Created: 2016-03-06
    7 ;; Keywords: tex
    8 
    9 ;; This file is part of AUCTeX.
   10 
   11 ;; AUCTeX is free software; you can redistribute it and/or modify it
   12 ;; under the terms of the GNU General Public License as published by
   13 ;; the Free Software Foundation; either version 3, or (at your option)
   14 ;; any later version.
   15 
   16 ;; AUCTeX is distributed in the hope that it will be useful, but
   17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
   18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   19 ;; General Public License for more details.
   20 
   21 ;; You should have received a copy of the GNU General Public License
   22 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
   23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
   24 ;; 02110-1301, USA.
   25 
   26 ;;; Commentary:
   27 
   28 ;; This file adds support for the bidi package version 31.7
   29 
   30 ;;; Code:
   31 
   32 ;; Silence the compiler:
   33 (declare-function font-latex-add-keywords
   34           "font-latex"
   35           (keywords class))
   36 
   37 (defvar LaTeX-bidi-package-options
   38   '("RTLdocument" "rldocument" "extrafootnotefeatures")
   39   "Package options for the bidi package.")
   40 
   41 (defun LaTeX-env-bidi-bib (environment)
   42   "Insert bidi-ENVIRONMENT and a bibitem."
   43   (LaTeX-insert-environment environment)
   44   (end-of-line 0)
   45   (delete-char 1)
   46   (delete-horizontal-space)
   47   (LaTeX-insert-item))
   48 
   49 (TeX-add-style-hook
   50  "bidi"
   51  (lambda ()
   52    ;; bidi.sty requires xelatex, so set the engine
   53    (unless (featurep 'tex-buf)
   54      (require 'tex-buf))
   55    (TeX-check-engine-add-engines 'xetex)
   56 
   57    ;; 1.4 Turning TeX--XeT features on and off
   58    (TeX-add-symbols
   59     '("TeXXeTOn" 0)
   60     '("TeXXeTOff" 0))
   61 
   62    ;; 1.5 Options of The Package: These macros rely on package option
   63    ;; "extrafootnotefeatures".  So check for it first
   64    (when (LaTeX-provided-package-options-member "bidi" "extrafootnotefeatures")
   65      (TeX-add-symbols
   66       '("normalfootnotes" 0)
   67       '("twocolumnfootnotes" 0)
   68       '("threecolumnfootnotes" 0)
   69       '("fourcolumnfootnotes" 0)
   70       '("fivecolumnfootnotes" 0)
   71       '("sixcolumnfootnotes" 0)
   72       '("sevencolumnfootnotes" 0)
   73       '("eightcolumnfootnotes" 0)
   74       '("ninecolumnfootnotes" 0)
   75       '("tencolumnfootnotes" 0)
   76       '("RTLcolumnfootnotes" 0)
   77       '("LTRcolumnfootnotes" 0)
   78       '("paragraphfootnotes" 0)
   79       '("setLTRparagraphfootnotes" 0)
   80       '("setRTLparagraphfootnotes" 0)))
   81 
   82    (TeX-add-symbols
   83     ;; 1.6 Paragraph Switching Commands
   84     '("setLTR" 0)
   85     '("setRTL" 0)
   86     '("setLR" 0)
   87     '("setRL" 0)
   88     '("unsetRL" 0)
   89     '("unsetRTL" 0)
   90     '("unsetLTR" 0)
   91 
   92     ;; 1.8 Typesetting Short LTR and RTL Texts
   93     '("LR" 1)
   94     '("LRE" 1)
   95     '("RLE" 1)
   96     '("RL" 1)
   97 
   98     ;; 1.9 Footnotes
   99     '("LTRfootnote"
  100       (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  101       t)
  102     '("RTLfootnote"
  103       (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  104       t)
  105     '("setfootnoteRL" 0)
  106     '("setfootnoteLR" 0)
  107     '("unsetfootnoteRL" 0)
  108     '("LTRthanks" 1)
  109     '("RTLthanks" 1)
  110     '("LTRfootnotetext"
  111       (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  112       t)
  113     '("RTLfootnotetext"
  114       (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
  115       t)
  116 
  117     ;; 1.9.1 Footnote Rule
  118     '("autofootnoterule"  0)
  119     '("rightfootnoterule" 0)
  120     '("leftfootnoterule" 0)
  121     '("LRfootnoterule" 0)
  122     '("textwidthfootnoterule" 0)
  123     '("SplitFootnoteRule" 0)
  124     '("debugfootnotedirection" 0)
  125 
  126     ;; 1.10 Two Column Typesetting
  127     '("RTLdblcol" 0)
  128     '("LTRdblcol" 0)
  129 
  130     ;; 1.11 RTL cases
  131     '("RTLcases" t)
  132 
  133     ;; 1.12 Typesetting Logos
  134     '("XeTeX" 0)
  135     '("XeLaTeX" 0)
  136 
  137     ;; 1.13 Separation Mark
  138     '("SepMark" "Mark")
  139 
  140     ;; 1.20 \setLTRbibitems, \setRTLbibitems, and \setdefaultbibitems
  141     ;; commands
  142     '("setLTRbibitems" 0)
  143     '("setRTLbibitems" 0)
  144     '("setdefaultbibitems" 0)
  145 
  146     ;; 1.21 Typesetting margin par
  147     '("setRTLmarginpar" 0)
  148     '("setLTRmarginpar" 0)
  149     '("setdefaultmarginpar" 0)
  150     '("LTRmarginpar" [ "Left margin text" ] "Text")
  151     '("RTLmarginpar" [ "Left margin text" ] "Text"))
  152 
  153    (LaTeX-add-environments
  154     ;; 1.7 Pargraph Switching Environments
  155     "LTR"
  156     "RTL"
  157 
  158     ;; 1.18 LTRitems and RTLitems Environments
  159     '("RTLitems" LaTeX-env-item)
  160     '("LTRitems" LaTeX-env-item)
  161 
  162     ;; 1.19 LTRbibitems and RTLbibitems Environments
  163     '("LTRbibitems"  LaTeX-env-bidi-bib)
  164     '("RTLbibitems"  LaTeX-env-bidi-bib))
  165 
  166    ;; Append "LTRbibitems" & "RTLbibitems" to `LaTeX-item-list':
  167    (make-local-variable 'LaTeX-item-list)
  168    (dolist (env '("LTRbibitems" "RTLbibitems"))
  169      (add-to-list 'LaTeX-item-list `(,env . LaTeX-item-bib) t))
  170 
  171    ;; Fontification
  172    (when (and (featurep 'font-latex)
  173           (eq TeX-install-font-lock 'font-latex-setup))
  174      (font-latex-add-keywords '(("LR"        "{")
  175                 ("LRE"       "{")
  176                 ("RLE"       "{")
  177                 ("RL"        "{")
  178                 ("LTRthanks" "{")
  179                 ("RTLthanks" "{"))
  180                   'textual)
  181      (font-latex-add-keywords '(("LTRfootnote"     "[{")
  182                 ("RTLfootnote"     "[{")
  183                 ("LTRfootnotetext" "[{")
  184                 ("RTLfootnotetext" "[{")
  185                 ("LTRmarginpar"    "[{")
  186                 ("RTLmarginpar"    "[{"))
  187                   'reference)
  188      (font-latex-add-keywords '(("XeTeX"   "")
  189                 ("XeLaTeX" "")
  190                 ("SepMark" "{"))
  191                   'function)))
  192  LaTeX-dialect)
  193 
  194 ;;; bidi.el ends here