Giter Club home page Giter Club logo

Comments (23)

alexandreroberts avatar alexandreroberts commented on August 16, 2024 1

Yes, I can confirm that \headlesscite (and variants, at least the capitalized and pluralized variants) work too. Thank you!

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!

from vimtex.

lervag avatar lervag commented on August 16, 2024

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.), another biblatex-chicago feature.

Hopefully this is a simple matter of tweaking the regex -- in any case, it would be wonderful to have this feature added!

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)?

from vimtex.

lervag avatar lervag commented on August 16, 2024

Also, can you refer me to the documentation of these commands?

from vimtex.

lervag avatar lervag commented on August 16, 2024

Btw., \volcite is alreadty implemented:

syntax match texCmdRef nextgroup=texRefOpts,texRefArgs skipwhite skipnl "\\[pPfFsStTaA]\?[Vv]olcites\?\>"

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

Ah, sorry, yes, you're right, \volcite is already covered. The main place where I've noticed the lack is when I use that capitalized version of these commands (\Cite, \Volcite, etc.).

\edcite and \transcite (and \Edcite and \Transcite) are my own, which would be nice to have covered, but I understand if you'd rather keep to more general-interest features. As for the biblatex-chicago commands, you can find a complete list in the package documentation, section 4.3.2.

MWE

main.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:

Screenshot 2024-01-27 at 8 00 42 AM

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

I just realized why I thought that \volcite had not been implemented: it only works without the (mandatory) volume argument! As far as I know, \volcite and its arguments should only be highlighted as a cite command when a volume is cited, as in \volcite{1}[23]{citekey} or simply \volcite{1}{citekey} but not if the volume argument is missing, so as to alert the user to the missing volume number.

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

Screenshot:
Screenshot 2024-01-27 at 2 35 35 PM

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

I've also noticed that the page number is correctly highlighted in the case of \Cite and \headlesscite (but not in the case of \volcite with volume number), suggesting that you already implemented these commands too but omitted to implement the correct highlighting of their citekey.

%!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[23]{worman}.

\mancite
Just the title:
\headlesscite[23]{worman}.

Volcite with volume number:
\volcite{1}[23]{worman}

Volcite without volume number:
\volcite[23]{worman}.

\end{document}
Screenshot 2024-01-27 at 2 37 34 PM

from vimtex.

lervag avatar lervag commented on August 16, 2024

Thanks for the detailed follow-up!

\edcite and \transcite (and \Edcite and \Transcite) are my own, which would be nice to have covered, but I understand if you'd rather keep to more general-interest features.

Yes, I don't want to add things that are personal here. Sorry!

As for the biblatex-chicago commands, you can find a complete list in the package documentation, section 4.3.2.

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?

I just realized why I thought that \volcite had not been implemented: it only works without the (mandatory) volume argument! As far as I know, \volcite and its arguments should only be highlighted as a cite command when a volume is cited, as in \volcite{1}[23]{citekey} or simply \volcite{1}{citekey} but not if the volume argument is missing, so as to alert the user to the missing volume number.

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?

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

For reference, here are the lines of the biblatex documentation about \volcite et sim.:

Screenshot 2024-01-29 at 10 32 45 AM Screenshot 2024-01-29 at 10 34 05 AM

from vimtex.

lervag avatar lervag commented on August 16, 2024

Let's focus on the bug report first:

  • As far as I can see, \volcite is properly highlighted. But you do need to load the biblatex package for this to work. FYI, the support for these commands is not very thorough; it works by allowing any number of groups of argument groups. But it should work more or less as expected, I think.
  • It seems \Cite does not work. I'll fix that now fixed.

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.

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

Thank you for fixing \Cite. I haven't tested that yet (I'm still working with the previous commit of vimtex).

As for \volcite, it does not appear to be correctly highlighted on my computer. Here is the updated MWE using plain biblatex:

MWE

main.tex:

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

% Normal:
\documentclass[12pt,article,draft]{memoir}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document}

\cite[23]{worman}

\Cite[23]{worman}.

This is good biblatex syntax, so the citekey SHOULD be highlighted as such and should not be spell-checked:
\volcite{1}[23]{worman}

This is bad biblatex syntax, so the citekey would ideally NOT be highlighted as such and SHOULD be spell-checked:
\volcite[23]{worman}

\parencite[23]{worman}

\pvolcite[23]{worman}

\end{document}

test.vim:

set nocompatible 
set mmp=5000

call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
call plug#end()

set spell

And this is what I get with nvim -u test.vim main.tex:

Screenshot 2024-01-29 at 11 20 31 AM

As you can see, the citekey is highlighted as a spelling error only when the \volcite syntax is right, not when it is wrong. The situation should be reversed.

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

In other words, the situation with \volcite (and all related commands like \pvolcite) is exceptional, in that it needs to be allowed (indeed required) to have that mandatory volume argument.

from vimtex.

lervag avatar lervag commented on August 16, 2024

Ony my end, both of the \volcite commands prevent spell checking.

from vimtex.

lervag avatar lervag commented on August 16, 2024

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 \headlesscite.

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

That is curious. I will now update the vimtex plugin on my computer and try again.

from vimtex.

lervag avatar lervag commented on August 16, 2024

Oh; the problem is with the concealed variants. I'll look into that now.

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

Ah, OK. Just to confirm the results of my update: I still am getting the spell-check highlighting on the correct \volcite command (i.e., the problem is not solved for me).

from vimtex.

lervag avatar lervag commented on August 16, 2024

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.

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

That did the trick, thank you!

from vimtex.

alexandreroberts avatar alexandreroberts commented on August 16, 2024

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 \volcite is to enter a volume number!

from vimtex.

lervag avatar lervag commented on August 16, 2024

Great; glad to hear it! So, over to biblatex-chicago. The docs were not very specific on the arguments for \headlesscite - could you check if the updates are sufficient?

from vimtex.

lervag avatar lervag commented on August 16, 2024

Great! Glad to hear it works as expected! And thanks for making it easy by providing all the necessary details!

from vimtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.