Hello all,
I am a very new user sorry, here goes....
I am using latex on vim in linux (actually gvim), and I have a syntax highlighting problem:
when write \citeasnoun{thecitation} only the portion of it 'cite' is highlighted.
whereas I would like it to behave the same way as \cite{thecitation} where the entire term is highlighted.
Has anyone come across this before?
Thanks
Text Formatting ⇒ citeasnoun highlighting
NEW: TikZ book now 40% off at Amazon.com for a short time.

citeasnoun highlighting
This is based largely on guesswork but seems to work for me. (I should note that I'm not using the vim-LaTeX suite plugin, so I hope that isn't involved here.)
First, make a personal copy of the tex.vim syntax highlighting file. For me, this involved the following commands from the terminal.
You may need to check the exact path to tex.vim, which may vary by distribution, and certainly varies by vim version. (I'm using 7.3 on Arch Linux.)
Now edit the file you just created ($HOME/.vim/syntax/tex.vim) and look for the line:
And a line just under it, just like it but with \\citeasnoun in place of \\cite
(I'm sure there's a way to do it on a single like with vim's regex patterns, but I'm too lazy to figure it out right now.)
Save and you should be all set. (Fingers crossed.)
First, make a personal copy of the tex.vim syntax highlighting file. For me, this involved the following commands from the terminal.
Code: Select all
mkdir -p $HOME/.vim/syntax
cp /usr/share/vim/vim73/syntax/tex.vim $HOME/.vim/syntax/tex.vim
Now edit the file you just created ($HOME/.vim/syntax/tex.vim) and look for the line:
Code: Select all
syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
Code: Select all
syn match texRefZone '\\cite\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
syn match texRefZone '\\citeasnoun\%([tp]\*\=\)\=' nextgroup=texRefOption,texCite
Save and you should be all set. (Fingers crossed.)
-
- Posts: 2
- Joined: Mon Nov 29, 2010 7:33 pm
Re: citeasnoun highlighting
Perfect thanks, I was previously attempting a similar process in the latex-suite without any luck.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
citeasnoun highlighting
Now that the problem is solved, please be so kind and mark the topic (not the last post) accordingly as clearly written in the Board Rules (to be read before posting). Please keep that in mind for the future so that further reminder will not be necessary.
Best regards and welcome to the board
Thorsten
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10