我texmf.cnf
在 上创建了一个文件。我在源 shell 文件 (和) 中~\texmf\mytexncf\
添加了导出命令。然后我运行了。export TEXMFCNF=~/texmf/mytexcnf:
.bashrc
.zshrc
texhash
当我从 shell 执行编译时,我没有遇到任何问题。但是当我从 texworks 编译时,我的texmf.cnf
似乎没有被 latex 命令 (pdflatex) 考虑在内。我尝试在.shrc
命令中添加导出命令,但它不起作用。
texworks 执行的是什么 shell?
语境:我编辑了非常大的 tikz 图片。这就是我创建该texmf.cnf
文件的原因。
答案1
texhash
如果您使用的是 TeX Live,则在将文件添加到个人树时无需运行。但是,我不会texmf.cnf
在那里添加您的自定义。TeXworks 可能会启动一个新的 shell 来进行编译运行,而这个 shell 可能不会读取~/.bashrc
。
更好的办法是将文件创建在 TeX 安装默认会查找的位置。例如,在 TeX Live 上,请阅读 顶部的注释texmf-dist/web2c/texmf.cnf
。在 Unix 类型的系统(例如 Mac OS X、GNU/Linux、BSD 等)上,您可以使用 获取文件的完整路径$(kpsewhich -var TEXMFMAIN)/web2c/texmf.cnf
。在我的系统上,例如
echo $(kpsewhich -var TEXMFMAIN)/web2c/texmf.cnf
返回
/usr/local/texlive/2015/texmf-dist/web2c/texmf.cnf
此文件包含如何以及在何处包含已修改设置的说明。例如,我的文件是这样的:
% 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.
按照这些说明,我所做的修改$(kpsewhich -var TEXMFMAIN)/../texmf.cnf
包括以下标题:
% (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! %
接下来是我想要修改的位的设置:
%%
% 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}
无论您是从命令行还是从 TeXworks 等编辑器内部进行编译,这都应该可以正常工作。