Texstudio: tkz-euclide/pgfplots macros/commands are not recognized

Created on 15 Oct 2019  路  13Comments  路  Source: texstudio-org/texstudio

Environment

  • TeXstudio: 2.12.16
  • Qt: 5.12.3 R
  • OS: macOS 10.14.5
  • TeX distribution: pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016)

Expected behavior

Things like tkz-euclide macros/commands are recognized

Actual behavior

image

This happens with tkz-euclide, pgfplots, and some other libraries

How to reproduce

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{helvet,parskip,amsmath}
\usepackage[a4paper, margin=1in]{geometry}

\title{Minimal Working Example}
\author{LoganDark}
\date{October 2019}

\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\baselinestretch}{1.25}

\usepackage{tikz,tkz-euclide}
\usetkzobj{all}

\begin{document}
    \begin{tikzpicture}[scale=1]
        \tkzInit[xmax=7,ymax=7]
        %\tkzAxeXY
        %\tkzGrid

        \begin{pgfinterruptboundingbox}
            \tkzDefPoints{3/3/C,6/3/R,4/6/sA,6/2/sB}
            \tkzInterLC(sA,sB)(C,R)
            \tkzGetPoints{A}{B}
            \tkzDefPointBy[homothety=center B ratio 1.25](A)
            \tkzGetPoint{Ae}
            \tkzDefPointBy[homothety=center A ratio 1.25](B)
            \tkzGetPoint{Be}
        \end{pgfinterruptboundingbox}

        \tkzDrawSegment(A,B)
        \tkzDrawSegments[style=dashed](Ae,A B,Be)
        \tkzDrawCircle(C,R)
        \tkzDrawPoints(A,B)
        \tkzLabelPoints[right](B)
        \tkzLabelPoints[above right](A)
    \end{tikzpicture}
\end{document}

image

cwl help wanted

All 13 comments

Texstudio probably should not strive to recognize all macros of all packages.

Then why does it have to mark them wrong?

They are just marked as "unrecognized command/environment" (when cursor is hover on the commands/environment).

Texstudio uses cwl files to highlight the predefined commands from loaded packages. It is welcome to to contribute to texstudio project by "adding missing cwl files". The related documentation can be found in Sec. 4.13 of texstudio's user manual. You can open the manual from texstudio's menu item "Help > User Manual", or here is a litter bit outdated online verion.

usually txs can parse unknown styles automatically to generate a provisional cwl in .config/texstudio/completion/autogenerated
This fails occasionally as .sty files are notoriously hard to parse.
You can generate a user file (see manual) which lists the commands, possibly just by extending whatever cwl txs has managed to generate.

See also FAQ: Why does TeXstudio mark a command as missing and the links therein.

We welcome if you want to contribute a .cwl with the command definitions of tkz-euclide.

@timhoffm this is still an issue until the cwl files are added. I'm not sure if I can add them myself but I think closing the issue is a bit drastic. This feels kinda like a "we don't care and you can do it yourself" so far

@LoganDark I'm sorry if this feels a bit drastic. We do have a .sty file parser that can automatically create basic cwl files, but it is not possible to identify all ways a command can be defined in .sty files. Additionally that parser cannot attach semantic information to the commands.

There are edge cases which require manual work. Given the limited bandwidth of core developers, we cannot promise to support these as a core feature of TeXstudio. We have to rely on community contributed .cwl files here, and we welcome these very much. But on the other hand, I don't see it as a bug of TeXstudio if they are not available. This part of language detection is inherently incomplete.

But on the other hand, I don't see it as a bug of TeXstudio if they are not available

Indeed, but could be considered as "enhancement".

I've introduced a new label "cwl" and reopened.

This will not be targeted by core developers, but everybody from the community is very welcome to contribute a hand-crafted cwl file.

Indeed, but could be considered as "enhancement".

At this point it would probably be better to create a new issue about the missing cwl files. From what I can see the devs don't feel like it would be worth the effort for TeXstudio to automatically look for commands, so an issue about the editor not discovering commands is basically a 'works as intended wontfix'.

From what I can see the devs don't feel like it would be worth the effort for TeXstudio to automatically look for commands, so an issue about the editor not discovering commands is basically a 'works as intendeed wontfix'.

I'm sorry, but that's absolutely not true. We do have put quite some effort in that automatism and it's working well, but TeX is too complex to make it work for all edge cases.

TeX is too complex to make it work for all cases.

Would you be willing to look into the specific method tkz-euclide uses to define its commands then? I understand it might not be possible to solve the issue for every package but the packages included in the distribution should work and be recognized, right?

Would you be willing to look into the specific method tkz-euclide uses to define its commands then?

I'm sorry, but no. Further improving the .sty parser this is a rabbit hole I won't dive into. I have too little time for this.

I understand it might not be possible to solve the issue for every package but the packages included in the distribution should work and be recognized, right?

Even that is a goal too high, unfortunately.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kadirseker00 picture kadirseker00  路  3Comments

MayeulC picture MayeulC  路  5Comments

antmw1361 picture antmw1361  路  7Comments

philippwerner picture philippwerner  路  3Comments

OsbertWang picture OsbertWang  路  6Comments