tags:

views:

119

answers:

2

Hey,

I have one document under ~/my_files/test.tex and want to include in test.tex some styling informations, which can be found under ~/latex/styles/info_hypersetup.tex.

When I include the following statement into my test.tex:

%% setting the infos for the pdf
\include{home/helex/latex/styles/info_hypersetup.tex}

I get the following error when running pdflatex test.test:

! I can't write on file `~/latex/styles/info_hypersetup.tex.aux'.

I set the rights to 777 but this doesn't changed anything. It works, if I put info_hypersetup.tex in the directory-structure where test.tex is. But I want to use this styleinformation as a global setting for all my documents and don't want to copy it into every project.

Thanks for your help.

A: 

Here is my dirty solution (because many people out there says not to use input but I want to get on :)):

\newcommand{\home}{../..}
\input{\home/latex/styles/info_hypersetup}

If you find something better, just let me know. The hint with setting output_any = a int the texmf.conf didn't work. I'm using ubuntu.

Matthias Guenther
A: 

~ is not a path in Unix, rather it is a path that Unix shells expand to the value of $HOME.

You've got a few possible ways to solve your problem:

  1. Define a macro \homedir whose value is coded in your Latex file to be the absolute path to your home (i.e., the contents of $HOME). Nonportable: if you move your file to another machine, it probably won't work.
  2. Use relative paths: this is what your solution does. If you move subhierarchies of files about, and are careful that that are self-contained, this works well.
  3. Create your own style file, say thisfilesystem.sty, with hardcoded values for various directories. You can then just change the values of this from machine to machine. This can also be created automatically from a Makefile.
  4. Use \write18 to run echo $HOME and bind this to you \homedir macro. It's portable, but I don't advise it: you should get into the habit of avoiding \write18, because it is an awful security hole.

I'd recommend #2.

Charles Stewart