Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the LaTeX kernel/base #131

Closed
1 task done
moewew opened this issue Oct 5, 2019 · 22 comments
Closed
1 task done

Update the LaTeX kernel/base #131

moewew opened this issue Oct 5, 2019 · 22 comments

Comments

@moewew
Copy link

moewew commented Oct 5, 2019

Via https://tex.stackexchange.com/q/511060/35864.

Tonight's MikTeX update installed the current versions 2019-10-01 of graphicx via the https://miktex.org/packages/graphics package (tools was also updated https://miktex.org/packages/tools), but the LaTeX kernel/base and amsmath is still at the previous release https://miktex.org/packages/ltxbase, https://miktex.org/packages/amsmath.

This means that simple documents like

\documentclass{article}
\usepackage{graphicx}
\begin{document}
Lorem
\includegraphics{example-image}
\end{document}

currently produce an error. (It can be verified using pdflatex-dev that this is not an error of the new LaTeX format.)

Please update ltxbase, amsmath and all other LaTeX base/kernel packages to the 2019-10-01 release.


See also MiKTeX/miktex#380.

@edocevoli
Copy link
Member

It seems that graphics was uploaded to CTAN a day to soon, i.e., I was not aware of a LaTeX base release when I updated graphics. (I am diffing FILES.byname in order to find update-able stuff.)

Please check for MiKTeX updates tomorrow.

@ctbhavius
Copy link

Updated to the latest Oct 5 patches, still getting the error on \includegraphics ....

@moewew
Copy link
Author

moewew commented Oct 6, 2019

Thank you for the swift response. The updated packages arrived this morning and the MWE now works after rebuilding the formats.

@ctbhavius The MWE should work now, but since the update involves changes to the LaTeX kernel, it is not enough to just replace files, the LaTeX formats also need to be rebuilt. Due to a misconfiguration on my system I couldn't check if the update triggers an auto-rebuild of the formats. If it does not do that you may have to rebuild the formats yourself (MikTeX Console > Settings > Formats > select all relevant formats and click Build format).

@ctaswell
Copy link

ctaswell commented Oct 6, 2019

Thanks for guidance about rebuilding formats, but regrets, in my hands on my machine, even after updating to latest patches and rebuilding formats, MikTeX is still crashing on the \includegraphics command.

Apologies, but due to time pressure on a manuscript, I have switched to typesetting the same LaTeX document with the TeX Live 2019 distribution, and my LaTeX source typesets fine without crashing on the \includegraphics command.

@jeroen
Copy link

jeroen commented Oct 7, 2019

@edocevoli would it be possible to release a new installation for windows? I am still experiencing this issue with todays basic-miktex-2.9.7216-x64.

Also the installer is numbered basic-miktex-2.9.7216-x64 but the log file shows: This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7200 64-bit)

@bernardosmarques
Copy link

I just reinstalled Miktex as well and am experiencing the same issue, it is giving me a "Undefined control sequence" for \includegraphics even after rebuilding the formats manually.

@PauliusSasnauskas
Copy link

PauliusSasnauskas commented Oct 8, 2019

Guys at https://tex.stackexchange.com/questions/511138/miktex-graphics-version-1-3b-bug-on-windows-10-setcurrfile-undefined have provided a solution:

\makeatletter
\def\set@curr@file#1{%
  \begingroup
    \escapechar\m@ne
    \xdef\@curr@file{\expandafter\string\csname #1\endcsname}%
  \endgroup
}
\def\quote@name#1{"\quote@@name#1\@gobble""}
\def\quote@@name#1"{#1\quote@@name}
\def\unquote@name#1{\quote@@name#1\@gobble"}
\makeatother
\usepackage{graphics}

I have no clue what this does, but posting here for the peeps who need to continue working

@pzobel
Copy link

pzobel commented Oct 10, 2019

I am still experiencing the "Undefined control sequence" error with the new basic-miktex-2.9.7219-x64 release.

@nickpoison
Copy link

October 11 - same problem here ... the temp fix posted above seems to work as a temporary solution.

@moewew
Copy link
Author

moewew commented Oct 12, 2019

OK, this turned out to be quite a tricky issue, since there are several things at play here.

The heart of the issue: Incompatible packages

The core of the issue I reported was as follows. The LaTeX development team released an update of the LaTeX kernel (LaTeX base in ltxbase) along with several core packages (e.g. graphics, graphicx, amsmath). The updated core packages depend on the LaTeX kernel and some need the correct version to function properly. Among these core packages was graphics/graphicx.

The packages and the kernel were uploaded to CTAN at almost the same time and arrived in TeX live with the same sweep of updates. Due to unfortunate timing, only graphics was updated in MikTeX leaving the LaTeX kernel on an older version. Using the graphicx package with the older kernel causes the error messages described in #132, #133 and the linked TeX.SX question (as well as its duplicates).

The core issue of the MikTeX package sever distributing incompatible packages was fixed swiftly the next day on 2019-10-06 (UTC). Since then the server has distributed the newest LaTeX base package (2019-10-01) that matches graphics.

The LaTeX kernel is special

Usually when a package is updated it is enough to renew the file name database to tell TeX about the addition or removal of files. This happens automatically when the MikTeX Console is used to update or install packages (same for TeX live's tlmgr and friends) so the average user will not have to worry about that.

But the LaTeX kernel is special. It defines a TeX format and is directly baked into the executable so that all LaTeX commands are available from the start without loading any packages (the LaTeX commands can be used without any \usepackage directly from the start). This means that it is not enough to renew the file name database when the kernel was updated: the formats also need to be regenerated and baked into the executables. Again this should happen automatically when the MikTeX Console is used to update the LaTeX kernel package.

OK, so what can I do?

Update in Admin and User mode

First of all you need to make sure that your MikTeX system is fully up to date. Run an update (see https://tex.stackexchange.com/a/55473/35864). If you have a multi-user MikTeX make sure to run the Update in User and Admin mode.

Double check that lxtbase is up to date by going to the Packages tab in the MikTeX Console and searching for ltxbase. The install date should be 2019-10-06 or later and the packaged date 2019-10-05. If you have a multi-user MikTeX install, the package may only be installed in one of the two modes. You do not have to click install in the other mode, you just have to make sure that it is up to date when it is installed.

In an ideal world that should be it. The formats should automatically be generated as needed during the update and things should work.

Small aside: The admin–user distinction is a common source of problems in MikTeX. The updater will always only update the packages installed with its permission level. If you have a multi-user installation and installed packages with User-level as well as Admin-level permissions, packages may get out of sync if you only update with one permission level. Whenever you encounter an update-related issue always make sure to update your system in Admin and User mode, often that makes issues go away. (Of course this only applies to multi-user MikTeX installs.)

Check your format

You can check your LaTeX format by running a simple LaTeX document like

\documentclass{article}
\begin{document}
Lorem
\end{document}

Open the resulting .log file and check out the first few lines

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7200 64-bit) (preloaded format=pdflatex 2019.10.12)  12 OCT 2019 11:42
entering extended mode
**./formatdate.tex
(formatdate.tex
LaTeX2e <2019-10-01>
("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2019/08/27 v1.4j Standard LaTeX document class

The important bit is the

LaTeX2e <2019-10-01>

the date should be 2019-10-01 or above.

The date in the preloaded format=pdflatex 2019.10.12 in the very first line should show a date after 2019-10-06.

Recreate the formats

If your formats are not new enough, MikTeX either did not recreate the format during the update or it did recreate the formats, but still picks up older versions of the formats.

You can rebuild the TeX formats as described in https://tex.stackexchange.com/q/500534/35864. You will need to rebuild all the formats you want to use (probably at least pdflatex, latex, xelatex, lualatex). It may be possible to simply select all formats and rebuild them, but some formats may produce errors on rebuild. In that case you may need to hand-pick the formats you need.

Again if you have a multi-user installation there might be a need to do this in Admin and User mode. Generally I recommend to rebuild the formats in Admin mode first (if you have Admin rights that is) and only then if still necessary in User mode.

In case the relevant formats create error you can not resolve or understand on rebuilding, ask a question on your favourite TeX forum and give enough details so people understand what you did.

If you rebuilt the formats and still MikTeX doesn't pick up the correct formats, your MikTeX might be misconfigured. This is then going to be a specific issue that can only be diagnosed with more detailed information about your system. Again it might be better to ask a question with as much detail as possible on your favourite TeX forum.

Last comments

The fix from https://tex.stackexchange.com/q/511138/35864 is only a temporary workaround. It should not be needed any more since the correct kernel version is now available in MikTeX. Please don't use this workaround any more. Instead make sure that you format gets updated correctly.

If you want to know more about TeX formats, LaTeX etc., have a look at http://www.tug.org/levels.html and https://tex.stackexchange.com/q/49/35864.

Incidentally new installers and the like will probably not help here, since this is purely an issue related to things that happen after installation. Indeed it may not even help to remove MikTeX and install a new version if problematic files remain in directories not controlled by MikTeX. It is therefore important to try and understand where the problem comes from before going on an uninstall-reinstall spree.

@scimax
Copy link

scimax commented Oct 12, 2019

Thanks @moewew for the detailed description on how to solve the issue! there was no overview like that before! I managed to fix my working environment!

@nickpoison
Copy link

" Admin and User mode " works ... the admin mode had no updates but the user mode did... thanks for the detailed help.

@tsfg
Copy link

tsfg commented Oct 12, 2019

After an Update a few hours ago the latex version has been the right one.
But a "Recreate the formats" from @moewew's (Thanks for the detailed description) post was still necessary.
Afterwards, everything seems to be o.k.

@smmurphy
Copy link

Thank you @moewew for the detailed response. I followed all of the checks you outlined, checked versions, updated in both admin and user mode, recreated all formats in both user and admin mode, confirmed format update dates in the relevant directories, etc. Graphics now render when using pdflatex, however, they are still not rendering when I use xelatex. Do you happen to have any suggestions about what else I might take a look at?

@moewew
Copy link
Author

moewew commented Nov 10, 2019

@smmurphy If pdflatex works, but xelatex doesn't then that seems to suggest that the pdfLaTeX format was properly regenerated, but the XeLaTeX format wasn't. Can you check the format version for the XeLaTeX run as described above? Is it LaTeX2e <2019-10-01> patch level 1 or newer? What error do you get exactly? ! Undefined control sequence. \Ginclude@graphics ...\Ginput@path \set@curr@file or something else entirely?

@smmurphy
Copy link

Thanks for the quick response @moewew !

From the log...

This is XeTeX, Version 3.14159265-2.6-0.999991 (MiKTeX 2.9.7200 64-bit) (preloaded format=xelatex 2019.11.9)  9 NOV 2019 22:10
entering extended mode
**./test.tex
(test.tex
LaTeX2e <2019-10-01> patch level 1
("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2019/08/27 v1.4j Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex/latex/base\size12.clo"
File: size12.clo 2019/08/27 v1.4j Standard LaTeX file (size option)
)

I don't see any errors in the log, but the images don't render in the pdf, whereas they did prior to update using xelatex and still do using pdflatex.

Interestingly it looks like pdf's render with \includegraphics{} but png and jpg do not.

Thank you for any help you are able to provide!

@moewew
Copy link
Author

moewew commented Nov 10, 2019

@smmurphy If you don't get any errors, then this is not related to the core of this issue here. I just tested in a small example document and XeLaTeX had no problems including PNGs, PDFs and JPGs. I suggest you ask a question about this on your favourite LaTeX forum, include as much info as possible. Ideally you would test image inclusion with files that are freely available like https://commons.wikimedia.org/wiki/File:Twemoji12_1f984.svg (PNG) and https://commons.wikimedia.org/wiki/File:Braunschweig_Brunswick_Einhorn_(2006).JPG (JPG).

@smmurphy
Copy link

Thanks so much @moewew will do!

@smmurphy
Copy link

Following up on this...

This issue came up using rmarkdown where the default pandoc template triggered the line, usepackage{graphicx,grffile} as opposed to usepackage{graphicx}. The below pull request sets this to the latter when using xelatex and resolves the issue for my purposes.

rstudio/rmarkdown#1692

@davidcarlisle
Copy link

@smmurphy the current grffile package does nothing other than load graphicx so it would be best not to load it, but loading it does no har m, it does nothing at all if you have already loaded graphicx. This is true of all engines, not xetex specific.

@gleichaufjo
Copy link

The described steps did not solve the issue for me. I still get the undefined control sequence issue when using \includepdf. Any suggestions how to solve this?

@jeroen
Copy link

jeroen commented Nov 18, 2019

Things were fixed for me but after basic-miktex-2.9.7255-x64 builds broke again but with another problem 🤦‍♂

tvercaut added a commit to MIDL-Conference/MIDLLatexTemplate that referenced this issue Dec 16, 2019
…ing#131 - trying to use an up-to-date version of miktek by building the docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests