83

I was typesetting a Tex file, but I got this warning:

! Package pgfplots Warning: running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \pgfplotsset{compat=1.6} into your preamble.

Now, I know that adding that line to the preamble solves the problem, but my question focuses more on the "why am I getting this" part of the problem.

What should I be looking for in my Tex file? Usually I get a "problem in line X" indication, but here, I'm lost. I don't understand what it is complaining about.

0

1 Answer 1

86

One of the principles which the LaTeX kernel, and many of the packages outside the kernel, attempt to follow is that documents should look the same (even up to spacing behaviour) when they recompiled on different machines with different package versions, even decades apart.

pgfplots is a regularly updated package that frequently adds new features and fixes bugs. This also means that some old documents might look different if recompiled with those new features/bug fixes enabled. Hence pgfplots provides a feature whereby you have to explicitly request which version of the package you want to use (or at least essentially, as the package provides backwards compatibility emulation for older versions), and hence which new features and bug fixes you want access to.

This is a "good thing", but it explains your warning - you are not using all the features and bug fixes available to you. Some of the fixes include better placement of tick labels, as mentioned in the warning. This is not enabled by default as it would clearly change how existing documents appear.

Section 2.2 "Upgrade remarks" of the pgfplots manual discusses this.

For completeness, I provide information on selecting the version:

  • Requesting a specific version

    To request a specific version, just use the compat option:

    \usepackage{pgfplots}
    \pgfplotsset{compat=1.7}
    
  • The bleeding edge (discouraged)

    You may be happy to live on "the bleeding edge" and to always use the most recent bug fixes etc that pgfplots provides. pgfplots also allows you to specify this, but encourages you not to as your document may compile differently before/after updating the package at certain times, and you may not be explicitly aware of the changes or what has caused them.

    Hence, if you choose to select the newest version with

    \usepackage{pgfplots}
    \pgfplotsset{compat=newest}
    

    then pgfplots still issues a message (not a warning) to remind you, which you might miss:

    Package pgfplots notification 'compat/show suggested version=true': document has been generated with the most recent feature set (\pgfplotsset{compat=1.7}).
    

    This notification can also be disabled:

    \usepackage{pgfplots}
    \pgfplotsset{compat=newest,compat/show suggested version=false}
    

    Remember though that the pgfplots author discourages this! Again, see the manual for the offical information.

8
  • 2
    I just ran into this warning and this answer is really satisfying. One issue remains though: how does pgf guess which version it should use to preserve aspect, and how can I check it guessed right?
    – nathdwek
    Jun 26, 2014 at 12:26
  • If the pgfplots manual doesn't help you, then I'm not sure I can either. The only time pgfplots guesses a version is when you request compat=newest and it tries to estimate which new features you are using and which you are not, to encourage you to request a specific version instead of newest. There have been some bugfixes etc that have not preserved compatibility, so loading compat=X may not be the same as loading version X of the package file as it was when released. For more help, I suggest that you start a new question with a MWE where someone more knowledgeable may find it. Jun 26, 2014 at 13:35
  • I was not aware of the behavior you described in your answer, so I was compiling an old document for another install without any compat=X and I obviously got the same warning asker did. Maybe my question should be: what version exactly (or what middleground/approach) is used in "backwards compatibility mode" when you don't specify anything, and on what basis does pgf suggest "use compat=X" (eg asker got X=1.6 and I got X=1.9)
    – nathdwek
    Jun 26, 2014 at 13:48
  • 1
    If you don't specify any compat then you get compat=default which is the same as pre 1.3. Obviously pgfplots cannot suggest a version newer than the version of the pgfplots package that is installed, but I don't know the specifics of how pgfplots suggests a version. Perhaps if there have been important bugfixes, it suggests newer versions even if it hasn't detected use of certain new features. If you want your document to look close to how it used to look, then find the date of the old document and try the latest pgfplots version that was available then! Jun 26, 2014 at 14:05
  • 3
    @SkeletonBow: think of the version numbers as dot-separated components, rather than decimal numbers. Since 14 > 9 > 7, hence 1.14 > 1.9 > 1.7. Does that help? It's just a case of the leading zeros being implicit (1.7 = 1.07 etc). Dec 10, 2016 at 9:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .