2

I created a texmf.cnf file on ~\texmf\mytexncf\. I added the export command export TEXMFCNF=~/texmf/mytexcnf: in my source shell files (.bashrc and .zshrc). Then I ran texhash.

When I execute a compilation from the shell, I have not any trouble. But when I compile from texworks, my texmf.cnf seems to not be taking into account by the latex command (pdflatex). I tried to add the export command in a .shrc command but it's not working.

What shell is executed by texworks?

CONTEXT: I compile very large tikz pictures. This is why I have created the texmf.cnf file.

Guuk
  • 1,495
  • 1
    If you are using TeX Live, you don't need to run texhash when adding files to your personal tree. Probably TeXworks starts a new shell for a compilation run which likely doesn't read ~/.bashrc. Better would be to create the file somewhere your TeX installation will look by default anyway. On TeX Live, read the notes at the top of texmf-dist/web2c/texmf.cnf. – cfr Aug 25 '15 at 13:27
  • I don't understand why you are altering texmf.cnf because you are compiling large TikZ pictures. What changes are you making exactly? – cfr Aug 25 '15 at 13:28
  • @cfr Thank you. I have put my texmf.cnf in the root directory of my TeX Live installation (on OSX: /usr/local/texlive/2015/ with root rights) as written in texmf-dist/web2c/texmf.cnf. Now it's working!! – Guuk Aug 25 '15 at 13:38
  • @cfr I plot very large 3D pictures and I need to extend the default main memory of latex processor. See on the pgfplots manual section 6.1. – Guuk Aug 25 '15 at 13:39
  • OK. I turned my comment into something vaguely resembling an answer ;). Glad it helped. – cfr Aug 25 '15 at 20:36

1 Answers1

3

If you are using TeX Live, you don't need to run texhash when adding files to your personal tree. However, I wouldn't add your customised texmf.cnf there. Probably TeXworks starts a new shell for a compilation run which likely doesn't read ~/.bashrc.

Better would be to create the file somewhere your TeX installation will look by default anyway. On TeX Live, for example, read the notes at the top of texmf-dist/web2c/texmf.cnf. On a Unix-type system (e.g. Mac OS X, GNU/Linux, BSD etc.) you can get the full path to the file using $(kpsewhich -var TEXMFMAIN)/web2c/texmf.cnf. On my system, for example

echo $(kpsewhich -var TEXMFMAIN)/web2c/texmf.cnf

returns

/usr/local/texlive/2015/texmf-dist/web2c/texmf.cnf

This file includes instructions for how and where to include modified settings. For example, mine says this:

% original texmf.cnf -- runtime path configuration file for kpathsea.
% Public domain.
% 
% If you modify this original file, YOUR CHANGES WILL BE LOST when it is
% updated.  Instead, put your changes -- and only your changes, not an
% entire copy! -- in ../../texmf.cnf.  That is, if this file is
% installed in /some/path/to/texlive/2015/texmf-dist/web2c/texmf.cnf,
% add your custom settings to /some/path/to/texlive/2015/texmf.cnf.
% 
% What follows is a super-summary of what this .cnf file can
% contain. Please read the Kpathsea manual for more information.
%
% Any identifier (sticking to A-Za-z_ for names is safest) can be assigned.
% The `=' (and surrounding spaces) is optional.
% $foo (or ${foo}) in a value expands to the envvar or cnf value of foo.
% Long lines can be continued with a \.
%
% Earlier entries (in the same or another file) override later ones, and
% an environment variable foo overrides any texmf.cnf definition of foo.
%
% All definitions are read before anything is expanded, so you can use
% variables before they are defined.
%
% If a variable assignment is qualified with `.PROGRAM', it is ignored
% unless the current executable (last filename component of argv[0]) is
% named PROGRAM.  This foo.PROGRAM construct is not recognized on the
% right-hand side. For environment variables, use FOO_PROGRAM.
%
% Which file formats use which paths for searches is described in the
% various programs' and the Kpathsea documentation (http://tug.org/kpathsea).
%
% // means to search subdirectories (recursively).
% A leading !! means to look only in the ls-R db, never on the disk.
% In this file, either ; or : can be used to separate path components.
% A leading/trailing/doubled path separator in the paths will be
%   expanded into the compile-time default. Probably not what you want.
%
% Brace notation is supported, for example: /usr/local/{mytex,othertex}
% expands to /usr/local/mytex:/usr/local/othertex.  We make extensive
% use of this.

Following these instructions, my modifications are in $(kpsewhich -var TEXMFMAIN)/../texmf.cnf which includes the following header:

% (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!
%

followed by settings for just the bits I want to modify:

%%
% ref.: norbert's answer at http://tex.stackexchange.com/a/262265/
TEXMFARCH = /usr/share/texmf
TEXMF = {$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST,$TEXMFARCH}
TEXMFDBS = {!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST,$TEXMFARCH}

This should work fine whether you compile from the command line or from within an editor such as TeXworks.

cfr
  • 198,882