This works in pdflatex but fails in the lua part of luatex's inclusion (this must be the most crazy filename ever seen:-)
\documentclass[aspectratio=1610,10pt]{beamer}
\begin{document}
\begin{frame}
\includegraphics{"plots/task-1/ABC123_/qa_pt:0.20-2.00/VtxZ (-10.00, 10.00)/charged; eta (-0.80, 0.80)/FB: 16; eta (-0.80, 0.80)/eff/eta_phi".pdf}
\end{frame}
\end{document}
This version works in lualatex and pdflatex
\documentclass[aspectratio=1610,10pt]{beamer}
\begin{document}
\begin{frame}
\includegraphics{eta_phi.pdf}
\end{frame}
\end{document}
To ensure the file is found prepend the plots directory to the input path for example this commandline works:
TEXINPUTS=./plots//: lualatex mainfile
as (assuming bash shell) this locally sets TEXINPUTS to search all directories under plots
If you really have painted yourself into a corner with duplicated filenames in "interesting" directory paths then this does work in lualatex
\documentclass[aspectratio=1610,10pt]{beamer}
\makeatletter
\def\Gread@@pdftex#1{%
\edef\Gin@attr@hash{%
\ifx\Gin@pagebox\@empty
\else
:\Gin@pagebox
\fi
\ifx\Gin@page\@empty
\else
:P\Gin@page
\fi
\ifx\Gin@decode\@empty\else
:D[\Gin@decode]%
\fi
\ifGin@interpolate
:I%
\fi
}%
\@ifundefined{#1 image\Gin@attr@hash}%
{%
\saveimageresource
\ifnum0%
\ifx\Gin@decode\@empty\else 1\fi
\ifGin@interpolate 1\fi
>0 %
attr{%
\ifx\Gin@decode\@empty\else/Decode[\Gin@decode]\fi
\ifGin@interpolate/Interpolate true\fi
}%
\fi
\ifx\Gin@page\@empty\else page \Gin@page\fi
\Gin@pagebox
{\expandafter\zz#1}%
\setbox\@tempboxa=\hbox{\useimageresource\lastsavedimageresourceindex}%
\def\Gin@llx{0}\let\Gin@lly\Gin@llx
\Gin@defaultbp\Gin@urx{\wd\@tempboxa}%
\Gin@defaultbp\Gin@ury{\ht\@tempboxa}%
\expandafter\xdef\csname #1 image\Gin@attr@hash\endcsname
{\useimageresource\the\lastsavedimageresourceindex}%
\expandafter\xdef\csname #1 height\Gin@attr@hash\endcsname
{\the\ht\@tempboxa}%
\expandafter\xdef\csname #1 width\Gin@attr@hash\endcsname
{\the\wd\@tempboxa}%
\Gin@log{%
<#1, %
id=\the\lastsavedimageresourceindex, %
\ifx\Gin@page\@empty\else page=\Gin@page , \fi
\ifx\Gin@pagebox\@empty\else\ifx\Gin@pagebox\GPT@cropbox\else
pagebox=\Gin@pagebox , \fi\fi
\ifx\Gin@decode\@empty\else decode=[\Gin@decode], \fi
\ifGin@interpolate interpolate=true, \fi
\the\wd\@tempboxa\GPT@space x \the\ht\@tempboxa
>%
}%
}{%
\def\Gin@llx{0}\let\Gin@lly\Gin@llx
\Gin@defaultbp\Gin@urx{\csname #1 width\Gin@attr@hash\endcsname}%
\Gin@defaultbp\Gin@ury{\csname #1 height\Gin@attr@hash\endcsname}%
}%
}
\def\zz"#1"{#1}
\begin{document}
\begin{frame}
\includegraphics{"plots/task-1/ABC123_/qa_pt:0.20-2.00/VtxZ (-10.00, 10.00)/charged; eta (-0.80, 0.80)/FB: 16; eta (-0.80, 0.80)/eff/eta_phi".pdf}
% \includegraphics{eta_phi.pdf}
\end{frame}
\end{document}
Best Answer
No special behaviour is assigned to any character in TeX, everything depends on the current catcode regime.
If
\catcode95=11
(often written as\catcode`\_=11
then_
is a letter and you can use it anywhere you can usex
sois all good and would typeset
a_b four
.But normally
_
has catcode 8 which means it has a subscript meaning if encountered in math mode, and an error if the character token would otherwise be typeset directly in text mode.However other uses of the token, it is just a character token so for example
is legal and defines
\foo
to be that sequence of tokens (it may possibly generate an error if used, but not necessarily, depending on context).Similarly in a
\write
or\csname
(both constructs used by LaTeX's\label
macro) any non active legal token just acts as itself so\csname one_two_three\endcsname
constructs the control sequence with nameone_two_three
which is the same as the\one_two_three
accessed above by use of catcode changes.Note that
\_
is just the control sequence with name_
it is not forced to produce an underscore. It does by default in latex, but just as\\
doesn't produce a backslash you could define\_
to do anything:would produce
zzzzz
for example.\_
is not predefined by TeX, laTeX defines it to be the macro: