Syntax highlighting for several languages ​​in one file: StatWeave / SAS / LaTeX

I use StatWeave to run SAS code from LaTeX files. I would like to be able to open the file in a text editor and view the main LaTeX document with LaTeX syntax highlighting and embedded SAS code fragments with SAS syntax highlighting. ("Code fragments" are real (working) code, not just for display, so I don’t think the LaTeX ad package will work.) I'm sure there should be a way with emacs to do this, but I don’t know I don’t know what is it ... At the moment I am open to any solution with any editor.

February 5, 2010 update: I decided that the best approach would be to stop trying to use StatWeave and SAS, and instead learn how to use Sweave and R. I am happy with Vim's Sweave highlighting, but I know other people who are very happy with ESS, therefore I will go further and accept this answer so that we can close this question.

+3
source share
6 answers

, MultipleModes Emacs Wiki . , Sweave , Emacs Speaks Statistics Sweave, StatWeave , , ESS . ESS, , SAS, .

+1

sas , '\ input' ? , , - /, "highlight" LaTeX, . , , , , . tex (re) script make, . generate_tex.sh script , , . -

#!/bin/bash
highlight -L -f --wrap-simple *.css --outdir ../input/
highlight -L -f --wrap-simple *.html --outdir ../input/
highlight -L -f --wrap-simple *.php --outdir ../input/

-. tex ,

\input{filename.css}
+1

UltaEdit ,

0

xemacs, mmmmode . ESS statweave, , ESS sybntax statweave . SAS, stata R , .  ( "mmm-mode" ) ( "mmm-vars" )  ( , setq mmm-global-mode) (setq mmm-subode-decoration-level-level 1)

(- "-" ((-    : r-    : mmm-code-subode-face    : - nil    : front "begin {Rcode}"    : back "end {Rcode}"    : back-offset (- char -1)    : insert ((? R R-tag nil @ "\ begin {Rcode}"   @ "\n" _ "\n" @ "\ end {Rcode}" @))    )   (STA-    : STA-    : mmm-code-subode-face    : - nil    : front "begin {Statacode}"    : back "end {Statacode}"    : back-offset (-char -1)    : insert ((? S STATA-tag nil @ "\ begin {Statacode}"   @ "\n" _ "\n" @ "\ end {Statacode}" @))    )))

( 'mmm-mode-ext-classes-alist      '(nil "-swv.tex" -))

SAS- ( , , ) latex.el( init.el) (  [ ( f1)]
 '(()   ()   ( (string-match "\.tex" buffer-file-name)  (progn   (let ( file-name1 file-name-wihoutswv)     ( setq (--))     (setq _1 ( -- ))     (setq file-name-wihoutswv (replace-regexp-in-string "-swv" ""     -name1))     (setq file-name-wihoutswv (replace-regexp-in-string "\.tex" " "     -wihoutswv))     ( (string-match" -swv \.tex "buffer-file-name)  (find-file-other-window (concat file-name-wihoutswv".tex"))  (find-file-other-window (concat file-name-wihoutswv "-swv.tex" ))  )     )   )     ( " Latex, swv TeX. tex sweave" )  )))

( - [f1]
'(()    ()    (-)    ( (string-match "-swv \.tex" buffer-file-name) (progn   ()   (-)   ;; (---)   (-)   (Mylatex--)   (-)   (save-window-excursion (run-current-statweave-file)) ; (Mylatex-)   )      ( (string-match "\.tex" buffer-file-name)   (progn     ()     (-)     ; (---)     (-)     (-PDF)  ; (Mylatex-)     ) ( " TeX SWV , , , . " ) ))    )

)

(defun run-current-statweave-file() " statweave -swv.tex evince " () (let ( file-name1 --wihoutswv cmd1-str cmd2-str status) ( setq (--)) (setq _1 ( -- )) (setq file-name-wihoutswv (replace-regexp-in-string "-swv \.tex "".pdf" file-name1)) ;; (setq cmd1-str (concat "statweave" file-name1 "& evince" file-name-wihoutswv "&" )) (setq cmd1-str (concat "statweave" file-name1)) (setq cmd2-str (concat "evince" file-name-wihoutswv "&" )) ;; ( cmd1-str) (setq output-buffer "swvoutput" ) (save-window-excursion ( setq (shell-command cmd1-str output-buffer)));; ( ) ;; (let (status) ((shell- cmd1-str output-buffer))))) ))

, lisp, , , .

0
0

To answer dicuss jean: The problem that I have always encountered with ESS is that functionality is not supported on Windows (where I run SAS).

Therefore, Statweave was not useful to me at all.

There is a version of SAS Linux these days, so I think it might work better.

0
source

Source: https://habr.com/ru/post/1707975/


All Articles