How can I get in TeXstudio the same syntax highlighting of TikzEdt? Look at the red word (called operation in Tikz, I think) "circle".
In TikzEdt:
In TeXstudio:
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityI got the desired result.
For some strange reason, circle
is highlighted as a grammatical error, that disappears if I select the dictionary in English (I'm italian).
It is not a big deal.
I'm not being able to create a working .qxf
file. I've create the file and put it in the folder where there is the texstudio.ini
file, as suggested by Troy, but it don't work.
Even the file .qnfa
that I've create didn't work, when put in the same folder.
So, how did I do it?
I've download the tex.qnfa
from the TXS's SourgeForge host, then I add the following code to this file:
<!-- ========================= tikzPICTURES ====================== -->
<context id="tikzpicture" format="picture" transparency="true">
<start parenthesis="tikzpicture:open@nocomplete" parenthesisWeight="30" fold="1" format="extra-keyword">\\begin{tikzpicture}</start>
<stop parenthesis="tikzpicture:close@nocomplete" parenthesisWeight="30" fold="1" format="extra-keyword">\\end{tikzpicture}</stop>
<sequence id="tikzpicture/keyword" ambiguous="true" format="lua:comment">\\[a-zA-Z@]+</sequence>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">circle</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">coordinate</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">grid</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">rectangle</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">ellipse</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">edge</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">--</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">at</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">to</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">node</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">-|</word>
<word id="tikzpicture/operation" ambiguous="true" format="lua:keyword">|-</word>
</context>
and put this file in the previous mentioned folder before the block of code that define the Syntax Highlighthing of PICTURES. It's possible put this code even after the PICTURES block, if you delete <e>tikzpicture</e>
from the PICTURES block of code.
Since I'm not succeed to create a working .qxf
file I've used the format of lua:keyword
suitably setted (Options > TeXstudio setting... > Syntax Hightligthing
. I've set the color to a52a2a
, that is the red-brown used in TikzEdt for circle
, rectangle
etc., and that's all.
I do not understand why a .qnfa
file with only the part that I added to the file tex.qnfa
does not work. Therefore I'm not very satisfied by the result. Please correct my prose, I don't speak english very well.
tex.qnfa
I find that in this file there is a repeated block at line nr 161 and 194 in all of which there is, I think, a syntax error prenthesisweight
instead of parenthesisWeight
tikzsyntax.xshd
), but certainly possible. I don't have time to look into it now, but maybe in the next few days... In the meantime you could give it a shot yourself..qnfa
in.\TeXstudio\config\languages
folder. And if you also want to add your own format, you need to define it inside a.qxf
file and place it in that same folder (or just edit thedefaultformats.qxf
file). Though, this discussion might be of interest to you as well. Like the manual said, these are extra experimental features, so there's little support from the devs for these.