LyXHow to convert a CWEB TeX document into a PDF document ?

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
sminacapelli
Posts: 4
Joined: Tue Nov 08, 2016 5:30 pm

How to convert a CWEB TeX document into a PDF document ?

Post by sminacapelli »

Hello.
Sorry in advance for my scarce knowledge of LyX.

I'm trying without success to convert the attached TeX file "dlx1.tex" into a PDF document, with my LyX version 1.6.10 in a Linux environment.
I know that also the attached TeX file "cwebmac.tex" must be processed, that defines some used macros.
I tried to put both files in the same directory, then to import the dlx1.tex, and finally to convert it into PDF. But I got a long list of errors during such conversion.

NOTE: Both TeX files are public domain in the context of CWEB literate programming of Prof. Donald Knuth. The first is just extracted via CWEB's tool "cweave" from the Knuth's file "dlx1.w". So I don't expect any error in it !

Please, can someone help me ? Thank you.
Attachments
dlx1.tex
(43.42 KiB) Downloaded 364 times
cwebmac.tex
(25.66 KiB) Downloaded 338 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: How to convert a CWEB TeX document into a PDF document ?

Post by Johannes_B »

Welome, why are you tryig o do that? Do you need to work with CWEB? Only very very few people know how to use it these days. Usually, people just use pdflatex to directly convert to a pdf.
I don't even know if LyX can work with plain.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
sminacapelli
Posts: 4
Joined: Tue Nov 08, 2016 5:30 pm

Re: How to convert a CWEB TeX document into a PDF document ?

Post by sminacapelli »

Thank you Johannes_B for your reply.
1) I need details on one of Knuth's algorithms, and such algorithm was "coded" in CWEB by Knuth.
2) Sorry, may be due to my lack of knowledge on LyX I don't understand your statements about "pdflatex" and "plain". Usually I use LyX to convert a ".lyx" document to a PDF. My question is: how can I convert the attached ".tex" document to a PDF via LyX ?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Re: How to convert a CWEB TeX document into a PDF document ?

Post by Stefan Kottwitz »

Wow, CWEB with LyX! That's a combination!

I suggest, at first try it with TeX (pdfTeX). If that works, than with LyX. That's because LyX bases on TeX.

Maybe Scott takes a look and has a suggestion, he is the LyX expert here.

Stefan
LaTeX.org admin
sminacapelli
Posts: 4
Joined: Tue Nov 08, 2016 5:30 pm

Re: How to convert a CWEB TeX document into a PDF document ?

Post by sminacapelli »

Hi Stefan.

I know that LyX is based on TeX, so I imported the TeX document "dlx1.tex" in LyX via "File -> Import -> LaTeX (plain)".
LyX let me search for a LaTeX (plain) file to import of type "*.tex" and I imported the file above without problems.
The TeX file was displayed in the editor window of LyX in a semi-readable form.

When I tried to convert it to a PDF I got a long list of errors.
I think that errors are there because LyX doesn't process the companion TeX file "cwebmac.tex" (containing the definition of some macros), just because I don't know how to say LyX to do that.
I tried to put the companion TeX file in the same directory of the first imported TeX file, but it doesn't work.

The problem is: HOW CAN I SAY LyX TO PROCESS THE COMPANION TeX FILE "cwebmac.tex" while converting to PDF the imported TeX file "dlx1.tex" ?

I think that CWEB is not a concern (so far) to give an answer to that question.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: How to convert a CWEB TeX document into a PDF document ?

Post by Johannes_B »

You are tellig LyX to use LaTeX on the file, that is TeX (the programm) loaded with LaTeX (a few years younger than plain TeX) on top of it. What you need is plain TeX, the format introduced by Knuth with TeX. The syntax is quite different.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
sminacapelli
Posts: 4
Joined: Tue Nov 08, 2016 5:30 pm

Re: How to convert a CWEB TeX document into a PDF document ?

Post by sminacapelli »

SOLVED

I was able to convert my TeX document to a PDF using pdftex, as suggested by Stefan.

I realized that "pdftex" program was already installed in my Linux system and I just execute "pdftex dlx1.tex" (after putting both TeX files in the same directory) getting "dlx1.pdf".

(What about LyX capability to convert a plain TeX file into a PDF remains open problem ?)

Thanks to all.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

How to convert a CWEB TeX document into a PDF document ?

Post by Stefan Kottwitz »

LyX can import LaTeX formatted files and compile it. The integrated importer was originally called tex2lyx, and this reads LaTeX. I guess it's just a rare requirement to completely use plain TeX with LyX, the popular use is LaTeX.

However, you can import plain TeX code by inserting an ERT TeX snippet, but into a LyX file that will be like a LaTeX document. I don't know if this is helpful - but a plain TeX file might work in a LaTeX/LyX document too.

Stefan
LaTeX.org admin
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

How to convert a CWEB TeX document into a PDF document ?

Post by scottkosty »

Stefan Kottwitz wrote:LyX can import LaTeX formatted files and compile it. The integrated importer was originally called tex2lyx, and this reads LaTeX. I guess it's just a rare requirement to completely use plain TeX with LyX, the popular use is LaTeX.
+1
Post Reply