.sty files (Tex Programming) and input Options

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

.sty files (Tex Programming) and input Options

#1 Post by s243a »

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: Select all

No driver specified
You should make a default driver option in a file
graphics.cfg
Here, is the code that produces the error:

Code: Select all

\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: Select all

\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:

Code: Select all

\usepackage[driver=none]{geometry}
http://texdoc.net/texmf-dist/doc/latex/ ... ometry.pdf

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:

Code: Select all

LN#65 \providecommand\Gin@driver{}
...
LN#72 \DeclareOption{pdftex}{\def\Gin@driver{pdftex.def}}
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 [url=https://www.minds.com/ns_tidder]minds[/url] and on [url=https://www.pearltrees.com/s243a/puppy-linux/id12399810]pearltrees[/url].

Post Reply