2

I am using tikz library files from this question.

I use the code: \usetikzlibrary{paths.ortho} and put files tikzlibrarypaths.ortho.code.tex and tikzlibrarypaths.ortho.tex in the root folder.

I wanted to know if it is possible to put the files into some other subfolder to utilise it? I just wanted to know it for better organization of my latex code.

Thanks !

  • See http://tex.stackexchange.com/q/1137/15925 - these are just another type of "style" file. – Andrew Swann Nov 20 '13 at 16:36
  • i tried to put it in my_root_dir/tex/latex/misc, but it doesn't work. root_dir meaning, where my latex source code is present. – knowledge_seeker Nov 20 '13 at 17:47
  • i want to keep it strictly to the source code where i am compiling the latex document, since I need to distribute it. – knowledge_seeker Nov 20 '13 at 17:58
  • Usually you need to run texhash, or its equivalent on your system, once you have placed the files there so that latex will find them. – Andrew Swann Nov 20 '13 at 20:02
  • I did try running texhash, but I get an error message saying - ! I can't find filetikzlibrarypaths.ortho.code.tex'. ...nput tikzlibrary\pgf@temp .code.tex \catcode `@ =\csname tikz... l.57 ...c,shapes, positioning,shadows,paths.ortho}

    (Press Enter to retry, or Control-D to exit) Please type another input file name:`

    – knowledge_seeker Nov 21 '13 at 14:46
  • @AndrewSwann This is not generally true. At least in TeX Live, if you install into your personal tree, running texhash is entirely superfluous. – cfr Apr 30 '15 at 23:36

2 Answers2

3

The \usetikzlibrary does some additional checking, testing and house-keeping, but essentially you should be able to just do

\makeatletter
\input{<subfolder>/tikzlibrarypaths.ortho.code}
\makeatother

where <subfolder> stands for the relative path from your main .tex file to the sub-folder the library files lie in.

Qrrbrbirlbel
  • 119,821
0

See also this related question Add search path for \usetikzlibrary, basically it is possible to add symlinks, or to use

\makeatletter
% Adds a subfolder to the search path
\def\input@path{{subfolder}}
% Tells tikz not to use its default input mechanism, but one that can recognize
% input@path
\let\pgfutil@IfFileExists     =\IfFileExists
\let\pgfutil@InputIfFileExists=\InputIfFileExists
\makeatother

then, use:

\usetikzlibrary{my.test}

as before (but it seems like libraries installed systemwide may have priority over \input@path… need to double check).

tobiasBora
  • 8,684