Posted: Thu 09 Jul 2020, 02:57 Post subject:
.sty files (Tex Programming) and input Options
I was troubleshooting a texlive installation that was likely missing some files due to insufficient memory during installation (at least that's my working theory).
I got the following error:
Code:
No driver specified
You should make a default driver option in a file
graphics.cfg
Here, is the code that produces the error:
Code:
\if!\Gin@driver!
\PackageError{graphics}
{No driver specified}
{You should make a default driver option in a file \MessageBreak
graphics.cfg\MessageBreak
eg: \protect\ExecuteOptions{textures}%
}
\else
\PackageInfo{graphics}{Driver file: \Gin@driver}
\@ifundefined{ver@\Gin@driver}{\input{\Gin@driver}}{}
\fi
From lines 97 to 107 of:
/usr/local/texlive/2020/texmf-dist/tex/latex-dev/graphics/graphics.sty
The solution is to add the [drive] option as an input to the usepackage command as follows:
Code:
\usepackage[pdftex]{graphicx}
According to the following link one shouldn't need to do this:
https://latex.org/forum/viewtopic.php?t=21570
due to good auto-detection. I haven't tried to get autodetection to work. In some packages you can specify autdetect. For example:
I notice that for the geometry pacakge the name of the driver is previxed with "driver=" but for the graphicx package using this (asignment style) prefix will break the latex document. What I don't understand is why we don't use this asignment style prefix in the graphicx package when specifying the driver. Some code from the graphicx package:
It seems that \DeclareOption must be an input option (like an argument) rather then some kind of select case control structure. I was originally thinking it was like select case so that when I pass driver=pdftex, we would select the case based on the value of the driver variable and return a configuration file for that driver (e.g. pdftex.def). However, this initial understanding was wrong and the option is an input argument rather than a branch in a case statement.
Since the notion for the geometry package is how I originally expected the graphicx package to work, I should look at how the coding differs. I'll probably paste this on a subsequent post. _________________ Find me on minds and on pearltrees.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum