Colour goes wonky in, and after, a \cite{}
Closed this issue · 9 comments
[ This appears to be similar to Issue #108 . ]
Good day,
First, thank you for this package!
I am attaching a screenshot where something wonky happens in a \cite{}:
-
In the middle of the \cite, the bibtex label changes colour to normal/white.
-
White continues until a new line begins, at which point the text changes to orange (\cite colour)
-
This continues for a fixed number of characters, where text suddenly reverts to normal white.
The problem appears to be attached to some fixed character count -- at least as a best guess. The problem also repeats for paragraphs that follow, until I start a line with a \section or some other clause.
Hope it can be fixed! Thanks, and be well.
--m.
Problem here is twofold:
The grammar scoper will only look at the first 1000 or so characters in a line. This is why it does not highlight the rest of the command. I have offered a solution, waiting for acceptance.
Second issue is ... no idea. I can't reproduce the extended highlighting behaviour with the text below.
abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcjdw\cite{Chen:2016}.
balals
Please give a "minimum working example" that will allow me to copy and paste to replicate the behaviour. It is possible an update to Atom has fixed it though.
The first problem should be solved by the PR above. Could you elaborate the second problem as @Aerijo says?
Happy to do so - what extra information can I offer? Below is an excerpt from the file (with sensitive info edited out). \ac derives from the acronyms.sty package. I can gather that:
-
deleting the comment appears to resolve the problem
-
deleting any of my (deprecated) formatting labels, eg. \em, appears to resolve the problem
Hope this helps!
\documentclass[a4paper,11pt]{article}
\begin{document}
%The
\ac{qoe}~\cite{akhshabi:2012,mansy:2014}. {\em may} {\bf \ac{qoe}-fairness}, \ac{qoe} measure, and showed that {\em network QoE-fairness}~\cite{mansy:2015}. Further, that application participation is needed to preserve fairness {\em by any measure} HTTP/2~\cite{Chen:2016}.
The key, rather than the standard bitrate approximated by TCP-fairness, is to the potentially vast number of sdfgcx.
A political space is novel because it has the potential to resolve questions and concerns about markdown to participate in two ways.
The proposed implementation follows two independent streams that can be coupled or de-coupled as required, enabling the system to fit
% \clearpage
% \section*{Management Plan} \input{mgmt}
\end{document}
OK, I am now able to reproduce your problem. This should be fixed by the introduction of limitLineLength
, but it apparently isn't... One workaround is not to put so many characters in one line, so you can avoid this problem.
P.S. never use \bf
!
Yes, indeed, wrt to \bf!! That was some old text that I'd pulled out, and failed to notice at the time.
I rarely put so many chars on a line, myself; that, too, was maintaining preferences from another source.
In any case, thanks for taking care of this. All the best!
@marwanfayed Just checking in: the issue is still present, but I've identified the cause. A fix is to use the package grammar-token-limit
and raise the value (150 works fine for me).
@yudai-nkt It's because only 100 tokens will be matched in a singe line. It is matching the begining of the cite, but gives up before the end, resulting in everything else being considered inside of the command (this can be seen by deleting one or two of the other commands before it).
I've been working on an inbuilt solution for this issue, to remove the dependency on that other package. It works (mostly fine) on my grammar package, but I'll improve it some more before submitting a pull request. It's largely the same as the package I link to, but with some changes to make it latex specific. I also translated it from coffescript to javascript.
I've been working on an inbuilt solution for this issue, to remove the dependency on that other package.
Since the aim of this package is provide syntax highlight and some basic snippets, such implementation is too heavy for this package and I'm not too keen on importing such kind of feature. Dependency is not a problem at all; if one wishes to increase the token limit, then please use gramma-token-limit
.
Line break in LaTeX is basically equivalent to a white space, so you don't need to worry about wrapping text at a certain length (I myself basically wrap per one sentence for the sake of visibility in diff). Why not discouraging users from putting so many words instead of removing dependencies?
@yudai-nkt In that case, we'll need to add a note somewhere very visible explaining how to fix this issue, and how to avoid running into it at all. Otherwise we'll keep getting issues like this one opened, because people don't understand what is happening; they will assume it's an issue with this package, and not realise that the other package they're supposed to depend on even exists.
The README file is probably where it needs to go, maybe it can have a FAQ section? I don't know the best way to do this. Unfortunately, the readme section also appears below 6 sets of language settings, so is less noticeable than I would like.