The partial answer I tried to give in my comments to the question couldn’t work, for at least two reasons:
a format file in the personal texmf tree ($TEMFHOME
) is not
permitted to override a system format file by the same name
(quite wisely);
in any case, the name of the format for the pdfTeX engine should be
pdflatex.fmt
, not latex.fmt
.
So, the best thing is to give the custom format a custom name (seems wise too). I’ll explain step by step a possible way to proceed, that, this time, I tested myself. Please note that the following instructions assume a TeX Live distribution!
First of all, create a temporary directory in any location of your file system; henceforth, this directory will be referred to as FOO/
. Next, let’s say that your custom hyphenation file looks like this:
% It's a dummy file dumyhyph.tex created for testing purposes.
% This file is normally defined in language.dat et may be used by language
% styles such as french.sty to define a temporary language. B. Gaulle 23/10/91
\begingroup
\patterns{ % dummy patterns
.ach4
z4zy
% I add a pattern that does permit hyphenation:
aa5a
% (hyphenation will be possible only at places where at least three consecutive
% "a" characters occur).
}
\endgroup
This is only an example, of course, but it is the example I shall use below. Note that it defines only one permissible hyphenation, namely aa-a
.
We’ll add at the end of this file the following line
\gdef\ParapaPonziPonziPo{*** This is my home-made LaTeX format! ***}
We do so just to have a means to check with greater ease that our custom format, and not the system one, is being loaded during a TeX run. So, our file now looks like this:
% It's a dummy file dumyhyph.tex created for testing purposes.
% This file is normally defined in language.dat et may be used by language
% styles such as french.sty to define a temporary language. B. Gaulle 23/10/91
\begingroup
\patterns{ % dummy patterns
.ach4
z4zy
% I add a pattern that does permit hyphenation:
aa5a
% (hyphenation will be possible only at places where at least three consecutive
% "a" characters occur).
}
\endgroup
\gdef\ParapaPonziPonziPo{*** This is my home-made LaTeX format! ***}
Save it in FOO/dumyhyph.tex
; note that the basename dumyhyph.tex
must be used. After this, make FOO
your current directory.
We’ll call our custom format pdflatexmyhyphen
; so, from within the FOO
directory, issue the following command at the shell prompt:
pdflatex -ini -etex -jobname pdflatexmyhyphen pdflatex.ini
After a short while, you’ll get the shell prompt again; you should now find that FOO
contains the following files:
dumyhyph.tex
pdflatexmyhyphen.fmt
pdflatexmyhyphen.log
texsys.aux
Spend a minute to take a look at the transcript file pdflatexmyhyphen.log
; scroll down until you find where it says
===========================================
Local configuration file hyphen.cfg used
===========================================
…some lines omitted…
\l@usenglish=\language0
\l@USenglish=\language0
\l@american=\language0
\l@dumylang=\language1
(./dumyhyph.tex)
The lines that says (./dumyhyph.tex)
proves that the file dumyhyph.tex
was input from the current directory, contrary to the other hyphenation pattern files.
OK, now run the command
kpsewhich -var-value TEXMFHOME
to learn where your system assumes your personal texmf tree is located; let’s say that the answer is
/home/donalddu/texmf
Then, create any missing directory in the path
/home/donalddu/texmf/web2c/
(note that /home/donalddu/
is supposed to be your home directory, so you can do so without any need for super-user privileges); finally, move—or copy—the file pdflatexmyhyphen.fmt
from FOO/
to /home/donalddu/texmf/web2c/
.
That’s all; as @cfr remarked, there’s no need to run mktexlsr
: your custom format, containing your custom hyphenation patterns, is ready for use.
So, let’s try it out, by compiling the following file—let us call it TryMyHyphenation.tex
:
% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.
\usepackage[T1]{fontenc} % Not always necessary, but recommended.
% End of standard header. What follows pertains to the problem at hand.
\ifdefined\ParapaPonziPonziPo
\typeout{\ParapaPonziPonziPo}
\fi
\usepackage[english]{babel}
\begin{document}
This is a paragraph written in English, to which English hyphenation rules
apply. It is followed by some other paragraphs written in our ``dummy
language''; in order to make our custom hyphenation rules apply to them, we
enclose them within a \texttt{hyphenrules} environment.
\begin{hyphenrules}{dumylang}
The ``dummy language'' is curiously similar to English, except that it doesn't
permit words to be hyphenated at all---or almost so. Indeed, a peculiarity of
this language is that it includes non-English words like
``mumbawohckijutresxxiukklanghornitudinal'' and ``axaxaxaaaxaxaxa'', and
that---aha!---hyphenation is permitted when three~``a'' occur in a row. So,
while, for example, ``mumbawohckijutresxxiukklanghornitudinal'' cannot be
broken, and hence produces ``overfull \verb|\hbox|es'', the word
``axaxaxaaaxaxaxa'' \emph{can} be hyphenated, provided, of course, that you are
using a \LaTeX\ format that incorporates our custom hyphenation patterns.
Another paragraph that again demonstrate this: pneumococcus, axaxaxaaaxaxaxa,
hyperbola, neutrino.
\end{hyphenrules}
\end{document}
First, try compiling it with the normal LaTeX format, with the usual command
pdflatex TryMyHyphenation
and look at the result: you’ll find that the word “axaxaxaaaxaxaxa” is not hyphenated.
Next, try compiling it with your new custom format: this can be done by means of the -fmt
command-line option. That is, type
pdflatex -fmt pdflatexmyhyphen TryMyHyphenation
Two thing should now happen:
during the compilation, you should see the message
*** This is my home-made LaTeX format! ***
and also find it in the transcript file;
TeX should now be able to hyphenate the word “axaxaxaaaxaxaxa”.
Here is the output I get in the second run:

Alternative method: Using fmtutil
to replace the original format
Yesterday I hadn’t tested this method yet, so I didn’t dare recommend it. Contrary to the previous answer, this time we will not make a custom format by a different name, but we’ll override the pdflatex.fmt
file itself with our custom version. Although it is not possible to do this from within the personal texmf tree, it can be done, under TeX Live’s supervision, from a different point of your home directory. It turns out that this solution is actually easier to carry out than the previous one; but replacing the (pdf)LaTeX format itself is something that not all users might feel comfortable with… (:-)
(Of course, there are also a lot of good reasons for which even knowledgeable users might simply prefer to avoid doing so.)
So, let’s start again from our custom dumyhyph.tex
file saved in a directory FOO/
of our choice (remember that, although the name and the location of the directory are arbitrary, the basename dumyhyph.tex
must be used):
% It's a dummy file dumyhyph.tex created for testing purposes.
% This file is normally defined in language.dat et may be used by language
% styles such as french.sty to define a temporary language. B. Gaulle 23/10/91
\begingroup
\patterns{ % dummy patterns
.ach4
z4zy
% I add a pattern that does permit hyphenation:
aa5a
% (hyphenation will be possible only at places where at least three consecutive
% "a" characters occur).
}
\gdef\ParapaPonziPonziPo{*** This is a home-made TeX format! ***}
\def\typeout{\immediate\write17}
\obeyspaces
\typeout{****************************************************************}
\typeout{* Custom hyphenation pattern file `dumyhyph.tex' has been *}
\typeout{* loaded instead of the original `dumyhyph.tex'! *}
\typeout{****************************************************************}
\endgroup
As you can see, I’ve added a few banner lines, that will be displayed during the format-making process. Make FOO/
your current directory and issue one of the following commands:
if you want to rebuild only the pdflatex.fmt
format file, issue
mktexfmt pdflatex.fmt
(this is what I recommend, at least for testing purposes);
if you want to rebuild all formats for the pdfTeX engine, issue
fmtutil --byengine pdftex
(are you sure that this is what you want?).
A lot of messages will flash on the terminal: one of them, displayed shortly before you get the shell prompt again, is important. It tells you where your custom format(s) has/have been installed, and it looks like this:
fmtutil: /home/mezzetti/.texmf-var/web2c/pdflatex.fmt installed.
Take note of this location! It’s system-dependent, and you might need it when you want to get rid of the custom format.
Assuming the location indicated above, you should also find a transcript file named
/home/mezzetti/.texmf-var/web2c/pdflatex.log
Open it: it should contain the following lines, more or less around line 400:
===========================================
Local configuration file hyphen.cfg used
===========================================
(/usr/local/texlive/2015/texmf-dist/tex/generic/babel/hyphen.cfg
File: hyphen.cfg 2016/02/24 3.9q Babel hyphens
(/usr/local/texlive/2015/texmf-dist/tex/generic/babel/switch.def
File: switch.def 2016/02/24 3.9q Babel switching mechanism
)
\l@english=\language0
(/usr/local/texlive/2015/texmf-dist/tex/generic/hyphen/hyphen.tex)
\l@usenglish=\language0
\l@USenglish=\language0
\l@american=\language0
\l@dumylang=\language1
(/Users/gustavo/Desktop/FOO/dumyhyph.tex
****************************************************************
* Custom hyphenation pattern file `dumyhyph.tex' has been *
* loaded instead of the original `dumyhyph.tex'! *
****************************************************************
)
This confirms that our custom hyphenation file was used (and, yes, it also shows that the system on which this example was generated is not very up-to-date…)
You are done. From now on, the format that incorporates your custom patterns will be used instead of the original one: no need to use any -fmt
option, just compile as usual.
When you want to get rid of the custom format(s), go back to your note and remove anything under .../web2c/
, including the directory .../web2c
itself. For example, assuming the location shown above, you’d go
rm -rf /home/mezzetti/.texmf-var/web2c/
To show another example, if the message you got after running mktexfmt
had been
mktexfmt [INFO]: /Users/gustavo/Library/texlive/2015/texmf-var/web2c/pdftex/pdflatex.fmt installed.
you would issue the following command
rm -rf /Users/gustavo/Library/texlive/2015/texmf-var/web2c/
to restore the distribution formats.
$TEXMFHOME/tex/generic/hyphen/dumyhyph.tex
(say) and rebuild the format.kpsewhich -var-value TEXMFHOME
to learn what$TEXFHOME
should expand to on your system. 2) Let’s say the answer is/home/mickeymo/texmf
; then you should create any directory in the path/home/mickeymo/texmf/tex/generic/hyphen/
that doesn’t exist yet; after this, try proceeding as I’ve indicated in my previous comment. There shouldn’t be any need to rebuild thelanguage.dat
file, only the TeX format(s) need to be rebuilt (but remember, I’ve never actually tried this out! :-) .