Typesetting the Kvant journal mathematical problem book (Задачник «Кванта» по математике)

I've visited a colleague of mine, Karel Horák, a Czech TeXist, in Prague and he presented/gave me a nice TeX problem. He wishes to get PDF file from TeX file. It sounds easy!

Issues of the Kvant (The Quant's mathematical problem book) journal have been released publicly some time ago (TeX, PDF, http://www.kvant.info/zkm_main.htm).

His first problem was which encoding the file is written in. He tried all the encodings in TeXworks with no luck. I've tried several automatic detection systems (first site, second site). They identified SJIS and UTF-8, that's wrong. I haven't tested chardet package in Python (that's a sort of my ToDo).

I've tried different strategy. I wished to test all the encodings from the iconv program. I've created a standalone Lua script to do that for me. We run texlua mal-split.lua:

-- I'm mal-split.lua...
-- I test all encodings from iconv -l...

os.execute("iconv -l >list.txt")
content=io.lines("list.txt")
for line in content do
for term in string.gmatch(line,"[^ ]+") do
print("Processing "..term)
command="iconv -f "..term.." -t UTF-8 zkm_main.tex >zkm_main-"..term..".tex"
os.execute(command)
end -- for term
end -- for line


Then I've tried to find some word from the PDF file (Copy+Paste) among those many TeX files. And that's it! The used encoding is probably one of these: CP866, CP1125 or CP1131.

There are some other problems to get PDF file from that TeX file:

• We are missing all the figures, see the \epsfbox command. We need to download them somehow from the server (if they are present there) or extract them from the PDF file or accompanying HTML+PNG files. We guess some of them are created in Metapost. We can remove this problem by defining \def\epsfbox#1{} at the beginning of the file. I have neither found the necessary files with pictures nor font files. I used wget -r -N http://www.kvant.info/ (2 GB). I wrote an email to the site administrator if they could provide them.

This is the reply to my humble request to get source codes of the figures:

  Hello, Pavel! I'm afraid the most of the data you requested is lost...
It has been a long time since *.tex files were produced. It's a chance
that you can find some pictures here
http://www.kvant.info/zkm_main.htm
Unfortunately it's not possible to contact the author of the files...
С уважением,
sergereal


The pictures loaded by the HTML webpage (GIF, JPG, SWF) are located in the /zkm_in/ folder, here they are: http://striz7.fame.utb.cz/docasne/zkm_im.rar

• The file is missing the preamble, there should be some as there are undefined commands like \LARGE. I haven't found another TeX file(s) at that server.
• We probably should load some support package(s) as they are using Cyrillic letters in the command names. Or we need to change engine from latex to something else...
• The list of fonts from the PDF file is: jour10, scbbx10, scbex10, scbit10, scbmi10, scbr10, scbsy10 and T1 to T9.

So the task is to reconstruct the preamble, that's my best guess. I'm trying to reproduce the PDF file by compiling TeX file by any means necessary.

These are some TeX files converted from CP866, from CP1125 and from CP1131 to UTF-8 just in case you cannot run the iconv tool. I enclose a preview of the first page of the PDF file.

• Do you want to write with Cyrillic letters? Usually I use \usepackage[utf8]{inputenc}\usepackage[T2A,OT1]{fontenc} – Sigur May 29 '14 at 23:22
• I don't think the encoding is relevant; a macro file is surely needed that defines \LARGE and similar commands, plus the fonts. – egreg May 29 '14 at 23:40
• ooh this question sounds very interesting! :) – Paulo Cereda May 30 '14 at 0:04
• Somewhat confused. You are trying to create a PDF which will look like a PDF you already have. Is that correct? – cfr Dec 13 '14 at 22:07
• @cfr Yes, that's correct. I tried to help my colleague to reconstruct all the necessary source codes. – Malipivo Dec 14 '14 at 9:26