I've put a new syntax/tex.vim on my website (and have given it to Bram
for inclusion in 7.3). You may try it out by getting it from
http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax and
clicking on tex.vim.gz . Of course you'll need a gunzip or similar tool
on Windows to decompress the file.
The new tex syntax file supports setting conceallevel to 2 with utf-8 by
showing appropriate glyphs for Greek in math, a few math symbols in
math, and a number of accented characters.
I personally have little call to use accents in my writing, so I may
well have missed some "favorites". If you'd like some accented
character that syntax/tex.vim is presently missing, please send me a
line or two of the form
syn match texAccent '\\c{c}' conceal cchar=�
where the '\\c{c}', for example, shows a Vim regex pattern matching the
LaTeX \c{c} which causes � to appear. To find the utf-8 glyphs, you may
wish to refer to http://www.utf8-chartable.de/unicode-utf8-table.pl .
You can find my email address at the 3rd line of vim73c/syntax/tex.vim .
Regards,
Chip Campbell
Why does the definition of the conceal syntax rely on &enc == 'utf-8'?
Removing those constraints and specifying the script is in utf-8
encoding (as in the attached patch) seems to work fine for me.
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jame...@jamessan.com>
scriptencoding utf-8
into syntax/tex.vim, since the script is, in fact, written with utf-8.
However, the
if has("conceal") && &enc == "utf-8"
lines are still needed. With <enc.vimrc> as:
--------------------------------------------------
set nocp
syn on
set cole=3
--------------------------------------------------
and using
--------------------------------------------------
vi -u enc.vimrc -c ":e ++enc=latin abc.tex"
--------------------------------------------------
on the following tex file named <abc.tex>:
--------------------------------------------------
\documentclass[12pt]{article}
\pagestyle{empty}
\title{nothing}
\begin{document}
\begin{equation}
\delta^0\\
\alpha\alpha = x^{a0123456789zABabTUW} \\
\beta\delta^3\\
y= z^{1.5}\\
\phi= x_{\chi}\\
x_1 + x_2 \\
\end{equation}
\`{a} \`{e} \`{i} \`{o} \`{u} \`{y} \`{A} \`{E} \`{I} \`{O} \`{U} \`{Y}
\'{a} \'{e} \'{i} \'{o} \'{u} \'{y} \'{A} \'{E} \'{I} \'{O} \'{U} \'{Y}
\^{a} \^{e} \^{i} \^{o} \^{u} \^{y} \^{A} \^{E} \^{I} \^{O} \^{U} \^{Y}
\~{a} \~{e} \~{i} \~{o} \~{u} \~{y} \~{A} \~{E} \~{I} \~{O} \~{U} \~{Y}
\~{a} \~{e} \~{i} \~{o} \~{u} \~{y} \~{A} \~{E} \~{I} \~{O} \~{U} \~{Y}
\r{a} \r{A}
\v{a} \v{e} \v{i} \v{o} \v{u} \v{A} \v{E} \v{I} \v{O} \v{U}
\aa \AA \k{a} \k{A} \c{C} \~{n} \~{N} \o \O \H{o} \H{O} \c{r} \AE
\ae \oe \OE \ss
\end{document}
Check if $x$
% vim: cole=2
--------------------------------------------------
shows rather unpleasant behavior otherwise.
Regards,
Chip Campbell
The '++enc=latin1' solely changes what &fenc is. Since the actual
contents of the file are all ASCII, this doesn't actually change
anything. If you meant that you're running in a UTF-8 locale (like
en_US.UTF-8) and you ran:
env LC_ALL=en_US.ISO8859-1 vi -u enc.vimrc abc.tex
then you're right, but only because your terminal is expecting UTF-8
bytes and you've told Vim (tangentially) to send latin1 bytes to the
terminal.
"set tenc=utf-8" will cause Vim to display all the glyphs which exist in
both UTF-8 and latin1 correctly and the others using the an upside-down
question mark (for me) instead of the "unknown character" glyph. This
sounds like maybe the conceal feature is relying on &enc instead of
&tenc for determining whether the concealed characters should be
displayed, which would be a bug IMO.
Hi Chip (and vim_dev),
I really like the idea of using conceal in the tex syntax file but it
still needs some work (I'm basing my comments on the version of
tex.vim that was included in the Sun 1 Aug changeset).
Try the following:
$\eps_b \geq \rho^{-\sigma b}$
- Super/subscripts look weird. The \sigma is typeset as superscript
"s i g m a" (each letter is a superscript). As it stands I'd rather
have no super/subscripts at all than this weird behavior. (In fact, I
dislike the super/subscripts anyway because they become so tiny that
they are hard to read unless you set your 'gfn' size to something
enormous.)
- Super/subscripts work inconsistently. Note that the "_b" after
"\eps" is not turned into a subscript. As far as I understand some
letters are not available as subscripts? Again, I'd rather have no
subscripts at all than to have some letters turn into subscripts but
not others.
- $, { and } are turned into "-". Why?
- I can think of a few more things to conceal (off the top of my
head): \infty, \in, \subset (and variants), \cup, \cap, \wedge, \vee,
the list goes forever on (it may be helpful to take a look at "short-
math-guide.pdf" by Michael Downes)
Anyway, I am grateful for the work you've put into this but there is
definitely room for improvement (my apologies for not simply sending
you a patch but I really should get back to writing that
article... ;-).
Björn