1

Is there a way to provide pictures for a 'global accessible' class file?

To use my own class and style files from everywhere, I put them in

C:\Users\myself\AppData\Roaming\MiKTeX\2.9\tex\latex\myfiles

One class file contains a titlepage

\ProvidesClass{classMyClass}[2014/05/06 my own class]
\LoadClassWithOptions{scrreprt}

\newcommand{\myTitelblatt}{
    \begin{titlepage}
        \includegraphics[width=8cm]{./pics/header}
    \end{titlepage}

Now I access the from let's say

C:\myTexts\myText.tex

\documentclass{classFestoDocu_fbwk}
\begin{document}
\myTitelblatt
hello
\end{document}

Is there a way I can provide the picture 'header' for the titlepage in the class file the same way as the class file itself? I want no subdirection 'pics' in C:\myTexts\but in C:\Users\myself\AppData\Roaming\MiKTeX\2.9\tex\latex\myfiles.

Phab
  • 161
  • You can put it in the same directory where your class is. This applies for pictures the very same way: http://tex.stackexchange.com/q/1137/11002 Also see: http://tex.stackexchange.com/q/108295/11002 – yo' Feb 18 '15 at 11:12
  • @yo' yes I know, it'll work if i put the image in C:\Users\myself\AppData\Roaming\MiKTeX\2.9\tex\latex\myfiles(with no subdir) and change the code to \includegraphics[width=8cm]{header}. But is there a way I can put it in a subdir? – Phab Feb 18 '15 at 11:28
  • Just try it, it should IMHO work. But, why would you want it? – yo' Feb 18 '15 at 11:33
  • Did you try pics/header instead of ./pics/header? – Paul Gaborit Feb 18 '15 at 12:27
  • I put the picture in a subdir named pics in ...\tex\latex\myfiles\ and still the command is just \includegraphics{header} (picture is named 'header.png'). Seems LaTeX finds the picture if the path is known and the file name unique. – Phab Feb 18 '15 at 12:36

1 Answers1

1

The solution was already there:

Put the image in a subdir of your choice under

C:\Users\myself\AppData\Roaming\MiKTeX\2.9\tex\latex\myfiles

The directory has to be a known path and satisfy the TeX directory structure. Also give your image an unique name.

Following open your command cosole (cmd) and type (and execute):

texhash

The code in your class file is just

\ProvidesClass{classMyClass}[2014/05/06 my own class]
\LoadClassWithOptions{scrreprt}

\newcommand{\myTitelblatt}{
    \begin{titlepage}
        \includegraphics[width=8cm]{header}
    \end{titlepage}

Note: there is no subdir given for the \includegraphics, but it seems LaTeX finds the image due to it's known path and unique name.

Phab
  • 161