# Compiling my own mktexfmt

I'm trying to compile my own version of pdftex which works fine. However, I must compile my own format file (fmt) for that. This should be done with `mktexfmt`. My problem is that I don't know where to find the souce code for `mktexfmt` (for Linux).

Can anybody give me a hint where to find it?

OK, looks like I need a small crash course in the LaTeX architecture.

This is what I understand now:

1. I don't need `mktexfmt` to create a format, I can use `pdftex -ini -etex`
2. A format is necessary to teach `pdftex` to understand latex
3. When I have "teached" `pdftex` how to understand latex I can parse latex files with `pdftex` and create pdf files from this

Is this correct?

If so, where do I get a .tex file to create a format? This ctan package looks good, but I cannot download it.

Sorry for beeing so dumb, but until now I only created nice pdfs with latex but I never got that deep into its architecture.

EDIT: I don't see the relevance of why I want to do this. But OK it's because I want to port PDFTeX to Javascript using `emscripten`. Does this help?

-
If you are compiling your own pdfTeX, then I'd imagine you are better off with the traditional approach of `pdftex --ini <file>`, maybe with `*` before the file name if you want the e-TeX extensions enabled. (You don't say which format you are after.) –  Joseph Wright Jan 7 '13 at 13:18
–  Claudio Fiandrino Jan 7 '13 at 13:28
I'm still not clear why you need to create your own format files, or to compile pdfTeX, both of which are pretty unusual tasks. –  Joseph Wright Jan 7 '13 at 17:40
About the addition: you need quite a big part of a TeX distribution, if you want to use (La)TeX for serious work. So compiling it without the `kpathsea` library and without an accompanying TeX distribution does not make much sense. –  egreg Jan 7 '13 at 22:23
Now I use this: Making TeX work, Chapter 4. Macro Packages. –  user24103 Jan 7 '13 at 23:37

If the TeX code for the format is `myformat.tex`, then

``````pdftex -ini -etex -output-format=pdf myformat
``````

will produce the file `myformat.fmt` that you can place anywhere the TeX programs would search for formats; for instance in

``````~/texmf/web2c/pdftex/
``````

The options:

• `-ini` means "be INITEX" (mandatory for building a format)
• `-etex` means "enable the e-TeX extensions (recommended)
• `-output-format=pdf` means "output will be PDF"
-
I would also recommend you to use the -enc (encTeX extension) argument, which allows you to enter your whole text as UTF-8 (with some configuration beforehand) –  RD6137 Jan 7 '13 at 15:01