-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cite command syntax highlighting including various variants introduced by biblatex-chicago #2875
Comments
I believe it should not be too hard. Could you provide a short example file that uses these commands and their forms? Preferable an example that compiles (just for completeness)? |
Also, can you refer me to the documentation of these commands? |
Btw.,
|
Ah, sorry, yes, you're right,
MWEmain.tex: %!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% Normal:
\documentclass[12pt,article,draft]{memoir}
\usepackage[notes, useibid]{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
\begin{document}
Test.\footnote{%
\cite{worman}.
Capitalized if ibid:
\Cite{worman}.
\mancite
Just the title:
\headlesscite{worman}.%
}
\end{document} test.vim: set nocompatible
set mmp=5000
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()
set spell Spelling errors are highlighted in red in this MWE, indicating when the cite command highlighting has not been triggered: |
I just realized why I thought that MWE 2%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% Normal:
\documentclass[12pt,article,draft]{memoir}
\usepackage[notes, useibid]{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
\begin{document}
Ordinary cite command:
\cite[23]{worman}
Capitalized if using ibidem.
\Cite{worman}.
\mancite
Just the title:
\headlesscite{worman}.
Volcite with volume number:
\volcite{1}[23]{worman}
Volcite without volume number:
\volcite[23]{worman}.
\end{document} test.vim: same as before |
Thanks for the detailed follow-up!
Yes, I don't want to add things that are personal here. Sorry!
To be honest, it's tricky to see which commands are special to biblatex-chicago. It seems most of the listed commands are already in biblatex and that they only have slighty ajdustments?
Is this true for biblatex or biblatex-chicago or both? As you probably see, I'm confused as to what here is related to biblatex and what is related to biblatex-chicago. Could I ask that we first fix things that may be wrong with biblatex, then add biblatex-chicago afterwards? Thus, could you first comment on if any of the things you are raising here are relevant as "bugs" for the current biblatex implementation? |
Thank you, yes, that makes sense.
I just checked the biblatex documentation and realized that you're absolutely right: almost all the commands that I had noticed are not being highlighted properly are biblatex commands (not biblatex-chicago).
The only exception to this is \headlesscite and related commands, which belong to biblatex-chicago (see p. 67 of the biblatex-chicago documentation, in section 4.3.2).
So you're right, what I am describing turns out to be two parts:
1. a bug report: that \Cite, \volcite, \Volcite are not being highlighted properly
2. a feature request: it would be nice to have certain biblatex-chicago commands covered as well, in particular \headlesscite et sim.
About \volcite in particular: the syntax I describe is already there in biblatex (see p. 115 of the biblatex documentation, within section 3.9.6). I think this is the only cite command (or rather the only family of commands, including \pvolcite, \fvolcite, etc.) that has the peculiar feature of having a required argument other than the citekey. (What I neglected to mention is of course the first optional argument, "prenote," which can be there in \volcite too, before the mandatory volume argument.)
|
Let's focus on the bug report first:
Can you please verify that I'm not mistaken somehow? I.e., modify your MWE to use only biblatex and verify that it does work as expected. |
In other words, the situation with |
Ony my end, both of the |
I've pushed a minimal version of biblatex-chicago now, FYI; it is probably not good enough yet, but at least it ensures to load the biblatex syntax rules and adds some form of support for |
That is curious. I will now update the vimtex plugin on my computer and try again. |
Oh; the problem is with the concealed variants. I'll look into that now. |
Ah, OK. Just to confirm the results of my update: I still am getting the spell-check highlighting on the correct |
I've pushed a fix for the volcites now. Notice that it is not ideal: The bad form will still "look" right. I hope that's OK. |
That did the trick, thank you! |
And yes, it's fine for the bad form to still look correct. It's the kind of syntax error one rarely makes, since the whole point of using |
Great; glad to hear it! So, over to biblatex-chicago. The docs were not very specific on the arguments for |
Yes, I can confirm that Now I think that everything related to this feature request/bug report that I had noticed was missing (other than my custom commands, of course) has been implemented. Thanks for doing it so quickly! |
Great! Glad to hear it works as expected! And thanks for making it easy by providing all the necessary details! |
Sorry to trouble you about this closed issue, but I have been trying to make my own "personal" biblatex cite commands highlight by mimicking your code, but clearly I don't understand how vim works. You wrote:
I tried to make syntax match texCmdRef nextgroup=texRefOpt,texRefArg skipwhite skipnl "\\[Ee]dcite[pt]\?\>\*\?"
syntax match texCmdRef nextgroup=texRefOpt,texRefArg skipwhite skipnl "\\[Tt]ranscite[pt]\?\>\*\?" But this gives me an error message and makes the highlighting not work at all. Is there a recommended way to do what I am trying to do? |
No problem!
Yes: I would add the additional syntax rules that you want to your The contents of that file should be the same as the lines you already tried: syntax match texCmdRef nextgroup=texRefOpt,texRefArg skipwhite skipnl "\\[Ee]dcite[pt]\?\>\*\?"
syntax match texCmdRef nextgroup=texRefOpt,texRefArg skipwhite skipnl "\\[Tt]ranscite[pt]\?\>\*\?" This is, by the way, a very good use case of the |
That did it, thank you! I thought I vaguely understood the |
Glad to hear it works! |
I wanted to ask here first before possibly opening a new issue, as I think it is a very similar question. I write a paper now where they expect apacite (specifically
for parenthesis and in-text citation, respectively. With a custom syntax rule specified in However, the EDIT: I realize now that this affects the ability to get the list of references as well, not only the highlighting. Can open an issue on this when I get some more time! |
I think this is an OK approach here. To allow the syntax match texRefADelim '<\|>' contained
syntax match texRefAOpt '<[^>]*>'
\ contained contains=texRefADelim
\ nextgroup=texRefOpt,texRefArg
syntax match texCmdRef '\\citeA\?' contains=texRefAOpt,texRefOpt,texRefArg
highlight link texRefAOpt texOpt
highlight link texRefADelim texDelim
I believe you are referring to completion, here? If so, please open an issue for that. But let's keep these things separated. I don't have a good way to allow easy customization of the completion "triggers", thus I'll have to accept changing the regex to allow this angled bracket variant as well. |
Is your feature request related to a problem? Please describe it.
While simple standard cite commands like
\cite[10]{ref}
are highlighted correctly, this is not the case for more exotic commands introduced bybiblatex
andbiblatex-chicago
(as well as some custom commands that I use).Describe the solution you'd like
I would like the same standard syntax highlighting to be applied to commands of these form as well:
\volcite{1}[10]{ref}
(with or without the optional input variable)\headlesscite[10]{ref}
(ditto)\edcite[10]{ref}
(ditto)\transcite[10]{ref}
(ditto)Also, all cite commands should be highlighted the same way if their first letter is capitalized (
\Cite
,\Volcite
, etc.), anotherbiblatex-chicago
feature.Hopefully this is a simple matter of tweaking the regex -- in any case, it would be wonderful to have this feature added!
Describe alternatives you've considered
I've just been using it as is, which is fine, but a bit distracting because all these cite commands have their citekey formatted as an ordinary word and underlined as a spelling error.
Additional context
The text was updated successfully, but these errors were encountered: