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

Extensions not appended to graphics when file exists #355

Closed
joel-coffman opened this issue Jul 7, 2020 · 1 comment · Fixed by #383
Closed

Extensions not appended to graphics when file exists #355

joel-coffman opened this issue Jul 7, 2020 · 1 comment · Fixed by #383

Comments

@joel-coffman
Copy link

Brief outline of the bug

Not sure if this issue is a bug or simply inconsistent behavior due to kernel changes related to the handling of file names. When including an image and the file name contains a dot (.), known extensions (e.g., .png) are automatically appended unless a file with the "base" name exists when using LaTeX2e <2020-02-02> patch level 2. For example, including the image latex-project-logo.svg.png fails when the file latex-project-logo.svg exists. In contrast, prior versions compile successfully when both files exist.

Minimal example showing the bug

\RequirePackage{latexbug}       % <--should be always the first line (see CONTRIBUTING)!
\documentclass{article}

% Any preamble code goes here
\usepackage{graphicx}


\begin{document}

  % Demonstration of issue here
  \includegraphics{latex-project-logo.svg}
  
\end{document}

Compilation fails with the following error message:

LaTeX Error: Unknown graphics extension: .svg.

To be clear, the directory contains the following files:

  • latex-project-logo.svg
  • latex-project-logo.svg.png
  • mwe.tex

Due to kernel changes related to the handling of file names, a slight change is needed to compile this document for older kernels:

-\includegraphics{latex-project-logo.svg}
+\includegraphics{{{latex-project-logo.svg}}}

With this change, the same document compiles on the following systems (pdfTeX and LaTeX versions copied from output):

  • Ubuntu 18.04: pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian); LaTeX2e <2017-04-15>
  • Ubuntu 19.10: pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian); LaTeX2e <2018-12-01>
  • Debian 10: pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian); LaTeX2e <2018-12-01>

Log file (required) and possibly PDF file

mwe.log

latex-project-logo.svg.gz (compressed due to GitHub's restrictions on types of attachments)
latex-project-logo.svg.png

@joel-coffman
Copy link
Author

joel-coffman commented Jul 7, 2020

Commit dba9642 appears to contain some relevant code. Because latex-project-logo.svg exists, \Gin@ext is defined and so the code that appends extensions is skipped (see required/graphics/graphics.dtx line 1136 and following).

Possibly related issues / discussions:

PhelypeOleinik added a commit that referenced this issue Aug 30, 2020
This changes the behaviour when searching graphics files and both
'file.exta' and 'file.exta.extb' exist, and 'exta' is not a known
graphics extension.  In that case, the list of known extensions is
searched, and if 'extb' is valid, that file is tried instead.
@PhelypeOleinik PhelypeOleinik linked a pull request Aug 30, 2020 that will close this issue
5 tasks
davidcarlisle pushed a commit that referenced this issue Aug 31, 2020
* Try known extensions in file with dots in the name (fixes #355)

This changes the behaviour when searching graphics files and both
'file.exta' and 'file.exta.extb' exist, and 'exta' is not a known
graphics extension.  In that case, the list of known extensions is
searched, and if 'extb' is valid, that file is tried instead.

* Add test for 02ddf2a

* Add changes.txt and ltnews32.tex entries for 02ddf2a
@PhelypeOleinik PhelypeOleinik added category graphics enhancement fixed in dev Fixed in development branch, not in stable release and removed to analyse further labels Aug 31, 2020
@PhelypeOleinik PhelypeOleinik added this to the release 2020 fall milestone Aug 31, 2020
joel-coffman added a commit to joel-coffman/latex-usafa.edu that referenced this issue Dec 7, 2020
Changes to the LaTeX kernel prevent files with multiple periods from
being handled consistently. Rather than use one of the workarounds for
consistency across systems (particularly CI infrastructure), this
change simply removes the offending file from the template.

GitHub issue: latex3/latex2e#355
joel-coffman added a commit to joel-coffman/latex-usafa.edu that referenced this issue Dec 7, 2020
Changes to the LaTeX kernel prevent files with multiple periods from
being handled consistently. Rather than use one of the workarounds for
consistency across systems (particularly CI infrastructure), this
change simply removes the offending file from the template.

GitHub issue: latex3/latex2e#355
@FrankMittelbach FrankMittelbach removed the fixed in dev Fixed in development branch, not in stable release label Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants