# Minimal installation for TeX (pdflatex/pdftex)?

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

Hello,

What would be the possibility of minimal installation for TeX (i.e to get just pdflatex and pdftex)?

Miktex runs on about 150 mb, Texlive can be also relatively small (less than 300 mb). texlive-texmf might increase a lot the size as shown:
Code:
New packages to be INSTALLED:
texlive-texmf: 20150523_4

Number of packages to be installed: 1

The process will require 1 GiB more space.
589 MiB to be downloaded.
Looking forward to hearing you.
Kind regards

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

If you get Knuths pascal sources compiled, then you get a real minimal TeX. For latex you need pdftex, I do not know the sources. Perhaps Donald Knuth wants exactly that: that people write their own compiler. Unfortunately there is no out of the box unbloated TeX, although TeX is far, very far away of being bloat.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

If you get Knuths pascal sources compiled, then you get a real minimal TeX. For latex you need pdftex, I do not know the sources. Perhaps Donald Knuth wants exactly that: that people write their own compiler. Unfortunately there is no out of the box unbloated TeX, although TeX is far, very far away of being bloat.
A main original "converter" of TeX to PDF was firstly made during a Phd. in CZ (EU).
miktex is a workaround, but well.

Btw, do you like automake, cmake,... bison to compile C?

There isn't a sort of code that does that?

#### getopt

##### Aspiring Daemon

Reaction score: 352
Messages: 584

Unfortunatelly the FreeBSD ports for Tex are a crap. This is because of the dependency madness and the unwillingness to maintain tex ports properly.

TeX Live - Quick install
2. Extract to /usr/local/texlive/install-tl-unx
3. Replace symlink /usr/local/share/tlpkg with empty directory
Welcome to TeX Live!

See /usr/local/texlive/2018/index.html for links to documentation.
The TeX Live web site (http://tug.org/texlive/) contains any updates and
corrections. TeX Live is a joint project of the TeX user groups around the
world; please consider supporting it by joining the group best for you. The
list of groups is available on the web at http://tug.org/usergroups.html.

to your PATH for current and future sessions.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Btw, do you like automake, cmake,... bison to compile C?
That things contribute to bloating. Better is to configure by editing a file and then do  make. But that is not the problem here. And there is such a code: you can get it from texlive with some effort.

TeX is written in simplified pascal (like C no procedure definition inside procedures), but a pascal dialect for which there is now compiler. web2c converts this pascal to C, but is bloated with a package called kpathsea: it is not like translated knuths original.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

That things contribute to bloating. Better is to configure by editing a file and then do  make. But that is not the problem here. And there is such a code: you can get it from texlive with some effort.

TeX is written in simplified pascal (like C no procedure definition inside procedures), but a pascal dialect for which there is now compiler. web2c converts this pascal to C, but is bloated with a package called kpathsea: it is not like translated knuths original.
Did he write it with fp (fp-ide) turbo pascal originally?

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

The whole source of TeX contain 4.6mb:

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Did he write it with fp (fp-ide) turbo pascal originally?
No, I think it was a Pascal for DEC System 10 called H-Pascal.

Pascal is/was not standarised, dialects may differ on small things, but enough to block compiling with false compiler.

There is a program called p2c to transform pascal to C: perhaps you can modify it to compile TeX.

The dialect is decribed in the very program that Knuth wrote: it is a mixture of TeX documentation and the Pascal program that you can separate with the programs  weave and  tangle delivered with TeX.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

No, I think it was a Pascal for DEC System 10 called H-Pascal.

Pascal is/was not standarised, dialects may differ on small things, but enough to block compiling with false compiler.

There is a program called p2c to transform pascal to C: perhaps you can modify it to compile TeX.

The dialect is decribed in the very program that Knuth wrote: it is a mixture of TeX documentation and the Pascal program that you can separate with the programs  weave and  tangle delivered with TeX.
thank you !!!

Maybe the plain TeX (the original plain TeX / not latex) .- basic compiler is easier to convert or to compile from Pascal source code....

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Maybe the plain TeX (the original plain TeX / not latex) .- basic compiler is easier to convert or to compile from Pascal source code....
I never saw the source of pdftex, but as far as I know it is a modified TeX from the source. Then it should compile with the same Pascal compiler. Latex are then TeX macros written on pdftex, should be not a problem.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

I never saw the source of pdftex, but as far as I know it is a modified TeX from the source. Then it should compile with the same Pascal compiler. Latex are then TeX macros written on pdftex, should be not a problem.
I think so far that he produces first the PS file and then make the PDF, if this remembering is correct.
Example of PS file.

% PostScript: "Hello, world!" of file test.ps
/Courier findfont 24 scalefont setfont
100 100 moveto (Hello, world!) show showpage

ps2pdf test.ps
mupdf test.pdf

Done.

Maybe ps2pdf is the only needed file executable.
The rest is just a markup language.

Another example:
\documentclass{article}
\begin{document}
Hello World!
\end{document}

latex test.tex // makes dvi file
dvips test.dvi // makes the ps file
ps2pdf test.ps // makes the pdf file

Actually, with this method, one need only the package : texlive-base, which is actually much less, but once one go the DVI file.
In there, there are: ps2pdf and dvipdf, which can convert a dvi file to PDF.

But it seems that /usr/local/bin/latex is missing.
This file has been forgotten in FreeBSD, see https://packages.debian.org/stretch/texlive-latex-base
latex is present in the source file: http://cdn-fastly.deb.debian.org/debian/pool/main/t/texlive-base/texlive-base_2016.20170123.orig.tar.xz

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Maybe ps2pdf is the only needed file executable.
Yes, with Knuths TeX and dvips that is enough to obtain a pdf file. But pdftex provides more than TeX, an extension of TeX that latex requires:

#### getopt

##### Aspiring Daemon

Reaction score: 352
Messages: 584

The whole source of TeX contain 4.6mb:

The 4.6mb are NOT the whole size of Tex Live. It's the size of the installer.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

Creating a dvi file without TEX : https://tug.org/pracjourn/2007-1/cho/cho.pdf

echo hello world > plaintex.tex ; echo "\\bye" >> plaintex.tex ; pdftex -output-format=dvi plaintex.tex will produce an example for studying it.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

The 4.6mb are NOT the whole size of Tex Live. It's the size of the installer.
No, the installer is a bloat of 3.3mb, the whole TeX and Metafont, including the TeX- and MF-Book, is 4.6mb, and textlive is a big bloatbomb of more than a Gigabyte. It is really a tragedy what TeX live did from TeX. tetex was a bloat, but texlive is by far much worse. A new, meager, portable, transparent distribution of TeX is really necessary.

I use only plain TeX, need dvips, but the minimal installation of Texlive are about 300mb, as Spartrekus noted.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

But perhaps is better to write a program for making easier the writing of usable postscript files.

Postscript, a real programming language, is much more expressive than dvi files. With it you can not only write text, but also draw. Since decades there are printers that understand directly postcript (MacWriter was the first and had a more powerful processor than the Mac). Ghostscript translates postscript to other languages of other printers. There is a lot of support for postscript files (viewers).

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

But perhaps is better to write a program for making easier the writing of usable postscript files.

Postscript, a real programming language, is much more expressive than dvi files. With it you can not only write text, but also draw. Since decades there are printers that understand directly postcript (MacWriter was the first and had a more powerful processor than the Mac). Ghostscript translates postscript to other languages of other printers. There is a lot of support for postscript files (viewers).
I don't know, either DVI or PS. It is the same for me.
DVI looks binary so far, from pdftex --output-format=dvi....
Actually the most important is the number of library dependencies related.
The less libraries and dependencies, the better. None, just clang and VT ANSI would be ideal

I think that first was PS, and DVI came after.

PostScript (PS) is a page description language in the electronic publishing and desktop publishing business. It is a dynamically typed, concatenative programming language and was created at Adobe Systems by John Warnock, Charles Geschke, Doug Brotz, Ed Taft and Bill Paxton from 1982 to 1984.

PS and DVI were born at almost same time.
DVI looks to me to need to create binary. PS looks more markup language - readable.
PS is hard to make - long for a single page with hello world.
DVI is much smaller, just hello world.

man tex
actually /usr/local/bin/tex is the main file, which might make dvi.
echo "\font\tenrm=cmr10 \tenrm M \bye" > test.tex
tex test.tex

Smaller and smaller ... Just 20 Mb....
What's into tex binary?
...
As said web2c will make the tex binary.
web.ch is the interesting file.

"Web2C is an implementation of TeX and friends which translates the original WEB sources written by Donald Knuth into C, so they can be readily compiled on modern systems. Kpathsea is a library providing path searching and other common functionality that Web2C and other programs use."
Example of binaries: http://mirrors.ctan.org/systems/os2/web2c-6.1/binary/web2c.zip

It seems:
weave tex.web
and then compiling the file with tex or pdftex. The program code is obtained by running
tangle tex.web
that produces tex.p.

"TeX is written in simplified pascal (like C no procedure definition inside procedures), but a pascal dialect for which there is now compiler. web2c converts this pascal to C, but is bloated with a package called kpathsea: it is not like translated knuths original."
Actually a just rewrite of main binary "tex" in C , like tex.c , would do it - and it would avoid all scripting (web2c, ... pl,...).
Is that right?

#### rigoletto@

##### Daemon
Developer

Reaction score: 892
Messages: 1,852

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Smaller and smaller ... Just 20 Mb....
What's into tex binary?
Perhaps debugging symbols? I compiled my own TeX and have 1274752 bytes, also a lot. Perhaps kpathsea is the inflation source.

Actually a just rewrite of main binary "tex" in C , like tex.c , would do it - and it would avoid all scripting (web2c, ... pl,...).
Is that right?
No rewrite necessary, the conversion of the pascal dialect to C should be very easy to do automatically, this means a new web2c program if you like. The rest should be straighforward: you translate and compile first tangle.p from the tex source, then use it to extract pascal files from the web files that you also translate and compile.

rigoletto@, it seems MiKTeX is also bloat. 150 mb for installation file, download of 1.3 GB necessary, then 2.4 GB On disk.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

Perhaps debugging symbols? I compiled my own TeX and have 1274752 bytes, also a lot. Perhaps kpathsea is the inflation source.

No rewrite necessary, the conversion of the pascal dialect to C should be very easy to do automatically, this means a new web2c program if you like. The rest should be straighforward: you translate and compile first tangle.p from the tex source, then use it to extract pascal files from the web files that you also translate and compile.

rigoletto@, it seems MiKTeX is also bloat. 150 mb for installation file, download of 1.3 GB necessary, then 2.4 GB On disk.
Well, my just generated dvi files are 224 kilo bytes .

I wonder if it is necessary all those converting, converting,.... to bring full installation of 1 GB.
2.4 GB is pretty interesting.

Luatex : http://www.tug.org/TUGboat/tb30-3/tb96hoekwater-pascal.pdf

A small rewrite in C language programming language would make it for sure - in less than 2 MB.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

I do not think the conversion is the problem: as said, it is straightforward. Donald Knuth is wise and wrote it in a limited dialect of Pascal for easy and efficient conversion. You can consider TeX as written in C with some trivial syntactic, but harmless errors to correct automatically with a program. That is sure not the source of the bloat.

Luatex is the result of some kid bloating TeX because they like lua so much. Always installed with texlive, also in "minimal" installations, because texlive people like bloat.

#### rigoletto@

##### Daemon
Developer

Reaction score: 892
Messages: 1,852

hruodr rather easier to maintain than the texlive total mess.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

I do not think the conversion is the problem: as said, it is straightforward. Donald Knuth is wise and wrote it in a limited dialect of Pascal for easy and efficient conversion. You can consider TeX as written in C with some trivial syntactic, but harmless errors to correct automatically with a program. That is sure not the source of the bloat.
Likely the best would be to have a pascal source file, then, process of hand PASCAL (DEC) => C could happen step by step.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 139
Messages: 921

hruodr rather easier to maintain than the texlive total mess.
Even better... !
Get the source over subversion ..... Only 35 GB

I am sure Knuth didn't want this to happen.

I can't believe that no single person did make a rewrite of it.
To create a dvi file - it seems fairly possible.

Maybe it has something to do with modern education and school content.
Probably, it has something to do with software engineering education ; they might benefit to REINTRODUCE Pascal and C language.
I recommend fp-ide in terminal (Pascal) on Raspberry PI for each student during labs.
Make your proejct light and efficient.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

No, really not by hand, never, please, use  weave and get the description of the pascal from the TeX sources, then you will understand what I am saying. The translation is not the source of bloat.

I can't believe that no single person did make a rewrite of it.
TeX is good, very good, no rewrite is necessary. But it would be nice if someone write an alternative, a new typography program, and the best would be to generate postscript directly.