# Minimal installation for TeX (pdflatex/pdftex)?

#### olli@

##### Well-Known Member
Developer

Reaction score: 277
Messages: 315

Do you really think that I do not know Knuths "The Art of Computing Programming"? If you read it carefully, you note that Knuth is not a computer scientist, but a mathematician.
Actually he is both (read his CV), but the field he works in and he is most famous for is computer science. TAOCP is about computer science, TeX and MF are works of computer science. Of course, all of that requires some mathematical background, too, but that's actually typical of computer science. You can hardly do computer science without mathematics.

Note that many famous computer scientists are also mathematicians. Historically, the field of computer science was branched from mathematics (at the beginning, computer science was barely more than a variant of applied mathematics). When I started studying computer science, the first four semesters had the same lectures as my fellow students who studied mathematics.

#### ralphbsz

##### Daemon

Reaction score: 1,013
Messages: 1,636

No, no, no!!!! He is a mathematician.
You are partially correct. His degrees are in mathematics. Yet, he is a professor of computer science. And his scientific contributions have mostly been to what today is called computer science. What this demonstrates is that the two fields have an overlap, which has been becoming narrower over the last 50 years. In reality, there is a large variety of overlapping fields of study here, and our naming has not kept up with them. I am very happy to see that today many universities have separate departments for computer sciences and computer engineering, since those fields have diverged considerably.

By the way, I highly recommend Don Knuth's "Concrete Mathematics" book. It is the clearest and most fun to read introduction to integer mathematics and combinatorics.

Also: Above I said that Don Knuth is "not a programmer". That statement is true: he is primarily a scientist. But he is also a great programmer. If you read his source code (for example the TeX source, which I have somewhere in book form), it is incredibly well written, cleanly structured, nicely thought out, clean and clear, and well maintainable. It is the product of a good engineer. And he is also perfectly capable of taking other people's code (like Tim's dvips, which is written in C) and working on it (I think Don restructured it over a summer, sometime in the 90s).

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

And he is also perfectly capable of taking other people's code (like Tim's dvips, which is written in C) and working on it (I think Don restructured it over a summer, sometime in the 90s).
For a minimal TeX package will be necessary to restaurate it by taking away kpathsea: I think some important improvements were done after infecting it with kpathsea.

Also from ` xdvi` kpathsea must be taken away. In spite that there are other viewers, ` xdvi` is very lightweight and can be more lightweight.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Tom Rokicki writes in http://www.radicaleye.com the follwing:

Namely, ` dvips` is delivered with Karl Berry's (TeXLive chef) initial non transparent inflation (kpathsea).

This dominant position of TeXLive may mean at the end TeX death.

#### olli@

##### Well-Known Member
Developer

Reaction score: 277
Messages: 315

This dominant position of TeXLive may mean at the end TeX death.
That's very unlikely. TeX has survived a lot more events than most other pieces of software that are of comparable complexity.

Also, I don't understand your problem with kpathsea. It's a library that made life a lot easier. I remember when it was introduced in the 90s. At that time I was using Eberhard Mattes' emTeX distribution, and later switched to Thomas Esser's teTeX, the predecessor of TeX Live.

By the way, TeX has always been a large piece of software, in relation to the disk sizes of the respective time. In fact, it has gotten smaller: In the first half of the 90s, I had to devote more than 10 % of my disk space to TeX. Today it's far less than 1 %.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Also, I don't understand your problem with kpathsea. It's a library that made life a lot easier.
With ` mf` and the source of fonts you generate tfm and gf files, and from the last eventually pk files with ` gftopk`. tfm files goes to a directory where ` tex` reads them, gf and pk files to directories where programs like dvips and xdvi read them. You can have scripts and makefiles to make life a little easier. Perhaps kpathsea makes life a lot easier for people that cannot keep order of his files, cannot run some commandos and are clueless about how the system works. For other people should be just unnecessary bloat that obscures the system.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

Tom Rokicki writes in http://www.radicaleye.com the follwing:

Namely, ` dvips` is delivered with Karl Berry's (TeXLive chef) initial non transparent inflation (kpathsea).

This dominant position of TeXLive may mean at the end TeX death.
If you note this, I believe that it would be urgent proceed to de-infection of TeX.

If anyone has time, please have fun converting the original code to something "lighter".

#### olli@

##### Well-Known Member
Developer

Reaction score: 277
Messages: 315

With ` mf` and the source of fonts you generate tfm and gf files, and from the last eventually pk files with ` gftopk`. tfm files goes to a directory where ` tex` reads them, gf and pk files to directories where programs like dvips and xdvi read them. You can have scripts and makefiles to make life a little easier. Perhaps kpathsea makes life a lot easier for people that cannot keep order of his files, cannot run some commandos and are clueless about how the system works. For other people should be just unnecessary bloat that obscures the system.
That's a gross underestimation of the complexity of a TeX system. Apparently you haven't been using TeX for very long.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

With a source code of about 35 GB (yep, .... gigabytes), TeX might be called a bit large - and likely complex.
It can be anyhow complex to make a pkg available in few megabytes, because of the required dependencies to get full features.

Ideally, keep focus the thread topic, which possibility or possibilities (list) would be given, in order to offer a binary pkg installation, i.e. base, that would be much less than 2.5 Gigabytes ?

#### ralphbsz

##### Daemon

Reaction score: 1,013
Messages: 1,636

I'm sorry, but your 35GB figure is not for TeX itself. I have no idea what it is for.

As I said above: The source code for TeX and MF has been published in book form. You can buy it in a book store, or find it in a good library nearby and read it. You can also download the source code in the Web language (which has nothing to do with the world-wide-web, it is a programming language designed by Don Knuth); the book is made from the same source code as the executable program. It is probably many MB, perhaps dozens. A skilled software engineer can preprocess and compile TeX and MF from the source code and make it work. Then you need to download a dvi output driver (for example dvips, preferably the dvipsk version). The source code for TeX, MF and dvips has not changed significantly in the last 20 years. We used to have it installed on NeXT and on VAXes, at a time when a typical main disk drive in a computer was 600MB in size (yes, I still have the MicroVAX and its 600MB disk drive sitting in my basement, and it should have a TeX installation on it, although I have not booted it in ~15 years).

Really, there are two paths. You can have skill, and install LaTeX and MF from source, and make it as efficient and small as you like (or as full-featured as you like). Or you can download the package and install it, but then please don't complain about the fact that the package maintainer has chosen to make it easy to use and feature rich.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

As I said above: The source code for TeX and MF has been published in book form. You can buy it in a book store, or find it in a good library nearby and read it. You can also download the source code in the Web language (which has nothing to do with the world-wide-web, it is a programming language designed by Don Knuth); the book is made from the same source code as the executable program. It is probably many MB, perhaps dozens. A skilled software engineer can preprocess and compile TeX and MF from the source code and make it work. Then you need to download a dvi output driver (for example dvips, preferably the dvipsk version). The source code for TeX, MF and dvips has not changed significantly in the last 20 years. We used to have it installed on NeXT and on VAXes, at a time when a typical main disk drive in a computer was 600MB in size (yes, I still have the MicroVAX and its 600MB disk drive sitting in my basement, and it should have a TeX installation on it, although I have not booted it in ~15 years).
This is maybe some idealistic dreams. Reality is rather that the packages are today getting large rapidly.

web.tex

It would be rather interesting to look at files, which allows TeX compilation (including results size as well) in details.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

Actually why to use TeX since the produre PS document from Huodr has already an excellent quality. It needs just section, subsections,... and maybe additional little features.

It would be simple to maintain, definitely small and producing high quality print.

Just for PDFLATEX or PDFTEX or TEX = 1 Gigabyte minimum ...

pkg install -y texlive-texmf texlive-base
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
Fetching packagesite.txz: 100% 6 MiB 1.7MB/s 00:04
Processing entries: 100%
FreeBSD repository update completed. 31962 packages processed.
All repositories are up to date.
The following 12 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
texlive-texmf: 20150523_4
texlive-base: 20150521_31
texlive-tlmgr: 20150523_2
tex-kpathsea: 6.2.1_2
teckit: 2.5.7
xpdfopen: 0.86
tex-ptexenc: 1.3.3_2
libpotrace: 1.12
libgd: 2.2.5_1,1
zziplib: 0.13.69_1
tex-web2c: 20150521_3
t1lib: 5.1.2_4,1

Number of packages to be installed: 12

The process will require 1 GiB more space.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

The postscript interpreter needs probably more resources than TeX. TeX is also necessary, because it is like a standard.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

If anyone has time, please have fun converting the original code to something "lighter".
You can begin.

` xdvi` exsists without kpathsea and compiles in FreeBSD with two little fixes. Se here:

It seems to be that one can clean the source of ` dvips` from kpathsea. It is with the source of TeXlive.

Working with the TeX sources to compile them you will learn a lot of good programming.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

You can begin.

` xdvi` exsists without kpathsea and compiles in FreeBSD with two little fixes. Se here:

It seems to be that one can clean the source of ` dvips` from kpathsea. It is with the source of TeXlive.

Working with the TeX sources to compile them you will learn a lot of good programming.
Why not to rewrite TeX completely from scratch. Basically it is only (hm hm) just a web file.
tex.web.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

Why not to rewrite TeX completely from scratch
Only for respecting Donald Knuth. That is enough a reason. He deserves this respect. If you think, you can do better, then you must write your own program. I suggested a postscript editor.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

Only for respecting Donald Knuth. That is enough a reason. He deserves this respect. If you think, you can do better, then you must write your own program. I suggested a postscript editor.
He might certainly have interests to see a readily human accessible file for studying how TeX works for education purpose.

Guess, the web code needs to be converted to single C file for education matters, without billions of necessary (un)maintained libraries or additional features.

Not necessarily to remake it, but to clean what is today "modern". TeX looks a bit like an Android mobile phone.
What you called "infected", I think that it is a good.

He strived to give a minimal TeX, stable, reliable, and that was perfect. It was basically just one major web file, powered TeX. The markup language gets converted to create dvi (and so on).
However, his perfect has incremented by "add-ons", and you know how TeX look like... it is actually modern.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

Which packages (pkg) holds pdflatex binary?

I installed 1.5 gigabytes already of TeX, with texmf and base, ... and still pdflatex is not there. Where is it?

I hope so much that it won't be tex - full ....

#### olli@

##### Well-Known Member
Developer

Reaction score: 277
Messages: 315

Which packages (pkg) holds pdflatex binary?
There is no such thing as a “pdflatex binary”. There is also no latex binary, because latex is just a macro package (“format”) that gets pre-loaded for TeX. In the same sense, pdflatex is just pdftex with the latex format pre-loaded. (All of these are symlinks. The respective format is loaded automatically according to the symlink's name.)

The tex and pdftex binaries are contained in the `tex-basic-engines` package (port /print/tex-basic-engines). The latex and pdflatex formats (along with the appropriate symlinks) are contained in the `tex-formats` package (port print/tex-formats). You get these automatically when you install `texlive-full`.

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

My self built "minimal" TeXlive contain latex.fmt in texmf-var/web2c/pdftex/latex.fmt.

The latex link to ` pdftex` reads from there the precompiled latex macros.

In texmf-var/web2c/tex/tex.fmt are the precompiled macros read by a simple ` tex` command: "plain tex" macros. But I have my own version in my home directory.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

My self built "minimal" TeXlive contain latex.fmt in texmf-var/web2c/pdftex/latex.fmt.

The latex link to ` pdftex` reads from there the precompiled latex macros.

In texmf-var/web2c/tex/tex.fmt are the precompiled macros read by a simple ` tex` command: "plain tex" macros. But I have my own version in my home directory.
How did you manage to get your "own" version? I want it too

#### hruodr

##### Well-Known Member

Reaction score: 40
Messages: 306

How did you manage to get your "own" version? I want it too
` tex -ini yourformat.tex`, then ` \dump` and quit with ` ^D`.

Place ` yourformat.fmt` in your local ` texmf/web2c/tex/` and call it with ` yourformat` linked to ` tex`.

Just do ` man tex`.

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

Is there so far a solution to install less than 1.5 GB for only pdftex and pdflatex?

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

It is more about size , but you can discuss about CVs and his research areas.

News, so errata.
I reinstalled FreeBSD v.12, and actually it is not 1.5 Gb to get PDFLATEX but 2.5 GB
pkg install texlive-base tex-formats

So another approach is to install just 14 MB and/or much more.
tex-web2c <--- this will increase the size with about 150 MiB Extras (skip! FreeBSD will install Wayland during this),
tex-kpathsea <-- very small,
tex-ptexecnc <-- very small.

Once <14mb done, you can use ftp.
ftp ftp://ftp.cvut.cz
Go into tex-archive
you can then get the knuth original web files, and then convert/compile.
Use tangle,...

Forget to compile it with clang, you need GNU GCC (Linux).

Copy GNU make into the /usr/bin/
You need gmake (Linux).

alt: https://ftp.osuosl.org/pub/blfs/conglomeration/texlive/texlive-20180414-source.tar.xz
tar xf texlive-20180414-source.tar.xz
./configure --enable-build-in-source-tree
make
make install

Delete the compiled source directory of several GB size.

Check that you have also texmf-config texmf-local texmf-var (small less than 5 mb) into /usr/local/share. Basically one can produce a pdf document with cmr10 with dpi 600, with only the cmr files.
It is not needed to install 1.5 GB therefore

Furthermore,
Installing with pkg install tex-basic-engines, then you will end with pdftex with just additional 4 MiB more downloaded. pdftohtml pdftops pdftotext pdftex is there.
Then, you will need to copy the fmt files manually to make it work.
But then from dvi to pdf, it requires 21Mb additional: "tex-dvipsk-5.995_2 Convert a TeX DVI file to PostScript" including dvips / dvipdf. But there it is 2 GB extras. dvips is likely not the best way either, as indicated above.

Probably quite interesting.
pkg install tex-basic-engines will install wayland !

It would be interesting to bring TeX on Unix/BSD/* systems : https://www.tuhs.org/Archive/Distributions/UCB/

OP
OP

#### Spartrekus

##### Aspiring Daemon

Reaction score: 140
Messages: 924

Valuable lectures / Stanford: