Texstudio: "Insert Graphic" generating code that doesn't compile due to missing \usepackage

Created on 22 Nov 2019  路  1Comment  路  Source: texstudio-org/texstudio

The "Insert Graphic" wizard may generate code that does not compile due to missing \usepackages. This happens when:

  • You insert a graphic without having \usepackage{graphicx}.
  • You place the graphic in a figure environment, select "Here (H)" as position, and don't have \usepackage{float}.

Ideally, a wizard would generate code that immediately compiles, or at least tells the user how to make it compile. Two suggestions are:

  • Put a warning box on the wizard telling you which packages you need.
  • Automatically edit the preamble to add missing \usepackages. (Though this is probably more complicated because it requires deciding where to put the \usepackage and it gets even more complicated when using the wizard in a non-master document.)

Environment

  • TeXstudio: 2.12.16
  • OS: all
  • TeX distribution: all

Most helpful comment

I up voted this issue but disagree with the suggestion "Automatically edit the preamble to add missing \usepackages.": it would be too much invasive (and order of packages sometimes matters).

Another option would be to warn the user just by a comment, just as e.g. Tables Generator does.

>All comments

I up voted this issue but disagree with the suggestion "Automatically edit the preamble to add missing \usepackages.": it would be too much invasive (and order of packages sometimes matters).

Another option would be to warn the user just by a comment, just as e.g. Tables Generator does.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kckennylau picture kckennylau  路  3Comments

MayeulC picture MayeulC  路  5Comments

homocomputeris picture homocomputeris  路  7Comments

Krzmbrzl picture Krzmbrzl  路  4Comments

erich666 picture erich666  路  7Comments