Problem with texmf.cnf in ubuntu
The answer depends on several issues:
More on the topic is treated in the question here; the Wikibooks material here; one of several resources on kpathsea here, and in the TeX Live documentation here.
-
One should not just use
locate
blindly and arbitrarily change a file. For example, Ubuntu stores its system-wide config in/etc/texmf/web2c/texmf.cnf
but manages that through scripts with some of its own TeX framework (tex-common) that will appear if one installs the texinfo package or lilypond or frescobaldi, even if one has a vanilla TeXLive 2016 install (or install-tl-ubuntu, which puts symlinks in /opt but does not change the locations below).The file
/etc/texmf/web2c/texmf.cnf
will not necessarily be found bykpsewhich -var-value TEXMFCNF
using a vanilla TL or equivalent (as you see below) but it should be found when using the Ubuntu packaged version. Yet I have not runsudo dpkg --configure tex-common
.So if you have the Ubuntu package version of TeX Live, or if texinfo, lilypond, or frescobaldi are installed, even if you have vanilla TL or equivalents on Ubuntu,
locate
will show at least the following:$ locate texmf.cnf /etc/texmf/web2c/texmf.cnf
If you do have vanilla TL or equivalents, you may get this:
$ locate texmf.cnf /usr/local/texlive/2016/texmf.cnf /usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf
or this:
$ locate texmf.cnf /etc/texmf/web2c/texmf.cnf /usr/local/texlive/2016/texmf.cnf /usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf
The file in
/etc/texmf/web2c
is managed by Ubuntu and should not be changed because it will be overwritten. It says so in the file.There may be different ways to add or change the config in the Ubuntu packaged framework, but using a local change in your home dir allows deja-dup to back it up (see 3 below) and allows you to keep personal changes persistent over system upgrades, distro changes, and so on.
The file in
/usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf
is the master file if you have a flavor of TL2016 or equivalent and should not be changed. It also says so in the file.One could modify site-wide options in
/usr/local/texlive/2016/texmf.cnf
if you have vanilla TL or equivalent. An extensive answer to that is the question here. -
If you want a local texmf.cnf file under
$HOME
, do the following:a. Get the value of TEXMFCONFIG via
kpsewhich -var-value TEXMFCONFIG
.b. Create a child
web2c
directory under that parent directory if the child does not exist. For example, if the parent is something like$HOME/.texlive2016/texmf-config
use
mkdir -p $HOME/.texlive2016/texmf-config/web2c
c. Put your local texmf.cnf in the child
web2c
directory.d. In your
.profile
do something like the snippet below. The variable substitution with the dollar sign and parens gets the result of the command inside the parens as an rvalue and assigns it to the the variable name. (Edit) The snippet below was modified to prevent errors, e.g., after changing distros or reinstalling, when kpsewhich is not found:## Find local config file, if needed testpg=kpsewhich if which "$testpg" 2> /dev/null; then temp=$(kpsewhich -var-value TEXMFCONFIG) if [ -e "$temp/web2c/texmf.cnf" ] ; then export TEXMFCNF=$temp/web2c: fi else echo "kpsewhich not found" fi
Now
kpsewhich -a texmf.cnf
should find your local file, e.g.:$ kpsewhich -a texmf.cnf /home/username/.texlive2016/texmf-config/web2c/texmf.cnf /usr/local/texlive/2016/texmf.cnf /usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf
This is an expansion of the answer by Norbert Preining.
Related videos on Youtube
fred62
Updated on August 01, 2022Comments
-
fred62 over 1 year
where do i have to place the texmf.cnf because i don't have a directory named /tex/2016 but four directory : texmf-config, texmf-dist, texmf-var, texmf-local, in my ubuntu 16.LTS thanks for the answer
-
cfr over 6 yearsIf you really have
/tex/2016
anything, then something is very seriously wrong: not with TeX, especially, but with your OS generally. Nothing like this should be directly under the root of the file system. You should not touch files managed by Ubuntu's package manager. I suspect you need to look in/etc
because Ubuntu has probably altered the way things are set up, but I don't know and have never used distro-packaged TeX Live myself, so this is just a guess.
-
-
cfr over 6 yearsThis does not really make sense. You aren't expanding on the linked information, you are contradicting it. You should only have the files you've listed if you have the remnants of an Ubuntu installation installed, together with vanilla TeX Live from upstream. But this really isn't recommended. Moreover, files in
/etc/
are typically meant to be customised according to local needs. Hence, the claim that you shouldn't edit that file because it is managed by Ubuntu is almost certainly fallacious. You should not need to change.profile
. Your instructions are probably wrong for the OP. -
Charles P. Schaum over 6 yearsI credited helpful sources. I tested this on Ubuntu MATE 16.10 and it works. The OP did not say if he had the Ubuntu version or vanilla TL on Ubuntu. I installed vanilla via install-tl-ubuntu. The texmf.cnf file in /etc/texmf says that it is auto-generated. Multiple sources and the config files in /usr/local indicate the substance of point 2. Point 3 I got from Norbert's Debian info and adapted it; the OP can check more. Getting the values from kpsewhich should work also for the package version. Yes you can change
.profile
to set environment vars at login. -
cfr over 6 yearsYour answer does not make clear that this applies to a very particular installation method.
install-tl-ubuntu
is not 'vanilla'. It is not doing at all the same asinstall-tl
. I am quite aware that.profile
can be used to set environmental variables. I said that it should not be necessary and not that you cannot do it. -
cfr over 6 years@jon What I mean is that the one in
/etc
is not vanilla. It is not part of an upstream install. You've done something else to add that.install-tl
does not touch anything outside/usr/local/texlive
(or alternative directory, if specified differently). -
cfr over 6 years@jon I didn't know you needed an actual
.cnf
forequivs
. I thought it just toldapt
that all the dependencies were satisfied. I don't have anything in/etc
(except in/etc/profile.d/
, but I did that) for TeX. But I'm not using a Debian-based system. -
cfr over 6 years@jon The question said it was some of Ubuntu's own TeX framework. In any case, my main objection is that this doesn't acknowledge a particular installation path clearly enough. (I also think it makes it sound as if changing the system-wide
.cnf
file is somehow to be considered only in extremis.) I'm generally against encouraging use of/.texliveYYYY
. After all, one way of solving problems is simply to delete the whole directory. If you put needed config there, you lose it. -
cfr over 6 years@jon A standard installation does not create anything in
/etc
. Period. -
cfr over 6 years@jon I wasn't disagreeing.
-
jon over 6 years(Summarizing deleted comments.) Note: on a Debian-based system, it is entirely possible to have
texmf.cnf
in/etc/texmf/web2c
even if you never installed TeX Live from the Debian/Ubuntu repositories. As it is (probably) system-generated from/etc/texmf/texmf.d/00debian.cnf
, users should not use it to change their settings (see point #2 above). (It is possible that it this is created when one uses theequivs
package to fool the OS into thinking you have installed TL from the repositories, but I'm not sure.) -
cfr over 6 years@jon Sorry, yes, I wasn't clear.