4

I need to use an absolute path for my package. One of the folder I use contains a space. I cannot change the name of this folder.

So, how can I use paths containing the space character in usepackage ?


EDIT

I tried to put my path between double quotes (") but then, Latex tries to open the "<my path>".sty !!

I am using pdftex (I don't know if this info is relevant).

Colas
  • 6,772
  • 4
  • 46
  • 96

3 Answers3

9

The initial statement is false:

I need to use an absolute path for my package.

\usepackage does not take a path at all --- it takes a package name.

Set TEXINPUTS to include the folder in which you have placed mdframed.sty and then just use

\usepackage{myownmackage}

For TeX Live and other web2c based systems you can set TEXINPUTS either as an environment variable or (better) in your texmf.cnf file.

David Carlisle
  • 757,742
  • Isn't this a bad example given that it would make much more sense to use tlmgr to install it? – cfr Sep 12 '16 at 23:11
  • @cfr not sure why I used that package name, probably I just had it in another answer at the time. Changed to a non standard name. – David Carlisle Sep 13 '16 at 06:47
5

If you're an expert with the terminal, you can add a symbolic link to the directory with a space in its name:

mkdir -p ~/Library/texmf/tex/latex
ln -s "/path/to/the/folder/with/space in name" ~/Library/texmf/tex/latex/spaceinname

Then simply doing \usepackage{mypackage} will find the file mypackage.sty in the folder with a space in its name. You can use whatever name you prefer instead of spaceinname, so long as it doesn't contain spaces (but it could).

On GNU/Linux systems, the Library/ part should be omitted, it's specific for MacTeX on Mac OS X.

egreg
  • 1,121,712
1

For example, if the path is /User/Bob/Google\ Drive/file.sty.

I think the simplest way is:

\usepackage{"/Users/Bob/Google\space Drive/file"}

I am using Latex. And it works.

  • 1
    \usepackage only takes a package name. If the package uses \ProvidesPackage, then LaTeX will generate a warning, if the name specified in \ProvidesPackage does not match the name in \usepackage. – Heiko Oberdiek Sep 12 '16 at 19:02
  • @HeikoOberdiek But it works for my Latex engine. – Alanthink Sep 12 '16 at 22:50
  • As David said above, it may half-work, but it is wrong and liable to break. If you want to use it yourself, fine. If it breaks, you get to keep all the itsy-bitsy teeny-weeny pieces in the funeral urn of your document. But please don't recommend this to others as they may not want funeral urns. – cfr Sep 12 '16 at 23:09
  • @cfr Thanks for your advice. I may use David's solution. – Alanthink Sep 12 '16 at 23:17