3

Right now, I save my own packages in the shown 'standard' directory.

enter image description here

I can use this package in MacTeX with a simple \usepackage{} command.

I want to backup my styles in iCloud without to copy it all the times. So I tried to create an alias but that is not working. Is there a way to change this directory?

2
  • You need to create a symbolic link using the terminal. Aliases are not quite the same thing. See Centralised .bib file on Mac
    – Alan Munn
    Commented Jul 1, 2018 at 15:55
  • I think you can do this in the terminal: TEXINPUTS="path/to/sty//:$TEXINPUTS" before compiling? Commented Jul 1, 2018 at 16:06

3 Answers 3

2

MacOS aliases are not quite the same as symbolic links, so if you want to have your local texmf folder be somewhere else, you need to link it using a symbolic link. So first move your existing texmf folder to some folder that iCloud syncs, e.g. your home Documents folder.

Then in the Terminal make a symbolic link:

ln -s ~/Documents/texmf ~/Library/texmf

(This assumes that iCloud syncs your Documents folder.).

Now you just use the iCloud texmf folder and it will always be seen.

2
  • No, there is no ~/iCloud folder
    – egreg
    Commented Jul 1, 2018 at 16:04
  • @egreg Oops. So then you just make sure it's a folder in your Home that is synced. Does my edit address that?
    – Alan Munn
    Commented Jul 1, 2018 at 16:05
5

I did the following test in the Terminal (bash shell)

cd
ln -s ~/Library/Mobile\ Documents/com~apple~CloudDocs iCloudFolder
TEXMFHOME=~/iCloudFolder/texmf pdflatex test

(this temporarily overrides the inner variable TEXMFHOME) and got

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2018-04-01> patch level 5
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo))
(/Users/enrico2013/iCloudFolder/texmf/tex/latex/test.sty
FOUND
) (./test.aux) [1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdf
tex.map}] (./test.aux) )</usr/local/texlive/2018/texmf-dist/fonts/type1/public/
amsfonts/cm/cmr10.pfb>
Output written on test.pdf (1 page, 8685 bytes).
Transcript written on test.log.

on my console.

The file test.tex contains

\documentclass{article}
\usepackage{test}
\begin{document}
x
\end{document}

whereas the texmf/tex/latex folder in the iCloud drive has test.sty which just contains

\typeout{FOUND}

As you see, the output is as expected.

Now just change the top level texmf.cnf file in /usr/local/texlive/2018 from

% (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
%
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is .../texlive/YYYY/texmf-dist/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
%
TEXMFHOME = ~/Library/texmf
TEXMFVAR = ~/Library/texlive/2018/texmf-var
TEXMFCONFIG = ~/Library/texlive/2018/texmf-config

to have

TEXMFHOME = ~/iCloudFolder/texmf

then copy texmf in ~/Library to the iCloud drive.

Note that this makes no assumption on what you sync with iCloud.

3

You can do \makeatletter\def\input@path{{path/to/styfiles/}}\makeatother before you do usepackage, but after \documentclass! Note the double {{}} and that the path ends with /!

E.g. if you have a directory called stydir/ containing mypack.sty you could do this:

\documentclass{article}
\makeatletter\def\input@path{{stydir/}}\makeatother
\usepackage{mypack}
\begin{document}
Hello
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .