|
From: | Lukasz Stafiniak |
Subject: | Re: [AUCTeX-devel] Feature Request: Preview-LaTeX in not TeX mode |
Date: | Sat, 10 Feb 2007 02:53:31 +0100 |
Why don't you want TeX mode? There is a best of all worlds solution: use MMM mode. * Learn about MMM (Multi Mode Mode) which allows having regions-subnodes with major modes different than the major mode for the file; install it. * add your TeX-comments submode with the standard math delimiters (also works with JsMath): (mmm-add-classes '((latex-math-comments :submode latex-mode :face mmm-declaration-submode-face :front "\\({\\)$$?" :back "$?$\\(}\\)" :front-match 1 :back-match 1 :insert ((?$ inline-math . (nil @ "{" @ "$" _ "$" @ "}" @ )) (?[ math . (nil @ "{" @ "$$" _ "$$" @ "}" @ )))))) (mmm-add-mode-ext-class 'pmwiki-mode nil 'latex-math-comments) * Add a preamble file (a TeX file with empty body, which loads libraries you use in your TeX comments) to directories with your source, let's store its full path as `preamble-file-name'. * After you load your source into the buffer, set: (set 'TeX-header-end "^[^%\n]*\\\\begin *{document}") (set 'TeX-trailer-start "^[^%\n]*\\\\end *{document}") (set 'TeX-master preamble-file-name) * Report how this works. On 2/9/07, Masayuki Ataka <address@hidden> wrote:
Hi, Aoki-San sent me a feature request for preview-latex, that users could write TeX commands in comments in program source files, and preview them using preview-latex. Source example: >>> fib.c <<< /* Return Fibonacci Numbers : $F_1=1,\ F_2=2,\ F_{n+2} = F_n + F_{n+1} \quad (n \ge 1)$ */ int fib(int a){ ... >>> END fib.c <<< Mathematicians and physicists often write program codes to simulate complex math formula, so it is helpful for them to write math formula using TeX commands and preview it just in source comments. I think, we can write a function such as preview-comments, by changing preview-region and adding some preprocesses. But I'm not familiar with preview-latex. Could you give me a comments? --- email: address@hidden Name:: Masayuki Ataka // (Japan) _______________________________________________ auctex-devel mailing list address@hidden http://lists.gnu.org/mailman/listinfo/auctex-devel
[Prev in Thread] | Current Thread | [Next in Thread] |