LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2022, 01:03 AM   #16
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,580

Rep: Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183Reputation: 2183

I have written scripts (perl) that retrieve data from database tables and create html in files…the html is never displayed in a browser during the processing, and it is not retained.
The html is then run through html2ps to create a postscript file, which is then run through ps2pdf to create pdf files.

I don’t recall offhand which of those conversion utilities controls the page width, but that’s not done in the html. Page height is managed during the html creation by inserting page break comments in the code. Most pages have a specific, fixed content. Pages that have “free form” text count print lines to decide when to insert the page break comment.

The resulting pdf file is then downloaded and printed.

I’m sure there are other ways to accomplish what I’ve done, but using perl to create html is something I was already very familiar with, so I only had to learn how to use the conversion utilities to accomplish the task.

So, I point the OP to those utilities.
 
Old 12-19-2022, 09:15 AM   #17
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 10,773

Rep: Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097
Look. When I asked you “what is your actual use case here,” I was asking why you were converting .tex to .odt. You still haven’t answered, but since you mentioned that you were writing a book, I’m guessing that it’s because your publisher wants ODT.

That’s the only reason I can imagine for not just keeping it in a format that won’t lose any formatting (LaTeX, Postscript or PDF).

That means that you don’t have to worry about things like page widths. They expect to request revisions, which will likely mean that formatting has to be redone, and then they’re probably going to do their own typesetting.

Last edited by dugan; 12-19-2022 at 09:37 AM.
 
Old 12-19-2022, 12:30 PM   #18
LinuxPoser777
Member
 
Registered: Jan 2018
Location: Nowhere yet
Distribution: Fatdog 4.14.12, Linux Mint 18.3, rarely Red Hat enterprise 7.2 Maipo
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
Look. When I asked you “what is your actual use case here,” I was asking why you were converting .tex to .odt. You still haven’t answered, but since you mentioned that you were writing a book, I’m guessing that it’s because your publisher wants ODT.

That’s the only reason I can imagine for not just keeping it in a format that won’t lose any formatting (LaTeX, Postscript or PDF).

That means that you don’t have to worry about things like page widths. They expect to request revisions, which will likely mean that formatting has to be redone, and then they’re probably going to do their own typesetting.
I just hadn't gotten to your post, I don't mind publicizing my use case which is as follows:

Yes, I'm writing a book, and I simply assumed that Libre Office Writer was the correct tool since I haven't used Microsoft Word in over ten years - I hunted down all of my XP and Windows 10 machines, and NONE of them have Word on them, or any of Office. I have used Writer sporadically but can passably use it enough to write a book as I've already gotten 110 pages done and it looks quite nice - it's just that I don't yet do fancy things with textflow. My publisher - it sounds like they use Word in their houses of worship. So when I upload to our publishing repository (each revision) I upload in 3 documents - odt, doc, and pdf. But honestly, I do the writing in odt within Libre Office. I would only use pdf as a final stage. The problem comes down to the inclusion of scientific or engineering style publications which I did in tex and exported to pdf which is tex's output. So when I went to include them in the odt, that's when the trouble started. I actually have NOT expermimented much with actually including the pdf directly in the odt but I suspect it's not going to work. Hence I started researching tex to odt conversion and got as far as HTML (which looks absolutely perfect). But I cannot get a nice-looking odt file to be generated by my processes which are the following two (I have not yet investigated opening the file in Word as I don't have Word):

1)
Commands 1 and 3 run without error if in 1 I use .eps file (not jpeg). But 2 has errors, not sure if the 3 errors mattered or not as it DID produce some output. But the 3rd command returned 0 – no errors at all, and it made an odt file – need to view the file.
1. latex filename.tex
2. bibtex filename.aux
3. mk4ht oolatex filename.tex

It’s sad but the #3 command turns vec into rightarrow and so it doesn’t work. I don’t know why the html file producing command preserves the vectors.

and

2) (this one shows real promise as it generates a terrific HTML file once I add one little tiny bit to it)

I tried various converters and combinations, but I obtained the best results with the following procedure.
1) Use htlatex to produce HTML code, with the following options:
htlatex document.tex "xhtml,mathml" " -cunihtf -utf8"
2) Convert the html with pandoc:
pandoc -s document.html -o document.docx

The above html conversion goes fabulously well but my t4ht is out of date.

The above looks great at the html stage but not good after the odt is generated. The odt file is just not there yet.

So the above is my USE CASE.

I do have some work on Windows but most of the book has been written on Linux with Libre Office Writer. I started the first
60 pages on my cellphone because I was sick but I'm better now and work on 3 of my PCs: Fatdog, Linux Mint, and Windows 10.


I guess I don't yet know exactly what the publisher will do with typesetting the final book - I can ask them though. They seem to like Word.

Last edited by LinuxPoser777; 12-19-2022 at 12:33 PM.
 
1 members found this post helpful.
Old 12-19-2022, 12:35 PM   #19
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 10,773

Rep: Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097Reputation: 5097
Your publisher accepts PDF? Your plan to just not bother with a word processor and to just do the whole thing in LaTeX is the correct one then.
 
1 members found this post helpful.
Old 12-19-2022, 12:54 PM   #20
LinuxPoser777
Member
 
Registered: Jan 2018
Location: Nowhere yet
Distribution: Fatdog 4.14.12, Linux Mint 18.3, rarely Red Hat enterprise 7.2 Maipo
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by dugan View Post
Your publisher accepts PDF? Your plan to just not bother with a word processor and to just do the whole thing in LaTeX is the correct one then.
Yes, I agree as it makes formula includion much smoother with the downside that Tex has very restrictive styles that you must master. It's slightly harder to use then odt in Writer, at least for me, since I've only done a small amount of work with it. At least I'll learn it better this time. But it's a shame, as the book so far has such a nice look and nice table of contents.
 
Old 12-29-2022, 07:59 AM   #21
LinuxPoser777
Member
 
Registered: Jan 2018
Location: Nowhere yet
Distribution: Fatdog 4.14.12, Linux Mint 18.3, rarely Red Hat enterprise 7.2 Maipo
Posts: 32

Original Poster
Rep: Reputation: Disabled
Yes, HTML is not my final product for a nicely laid out document

Yes, I admit to TurboCapitalist and Dugan that I'm wrong to try to push HTML to it's limits contentiously.

The reason I did is that I was surprised at Libre Office's lack of ability to better deal with mathematical vectors so I've been forced to lay the book out in Tex AND in the original way, which was to use odt file format in Libre Office Writer. The problem is I have to include some physics/math documents that have vector equations in them.

But I wanted the HTML file to look nice and I was able to acheive that - and I wanted the Libre Office people-developers to see just how nice the HTML renders vectors - and they are NOT images - they are using MathML, which is great. The internal format of Libre Office does something to the vector equations.

By showing the world the HTML file's abilities, I am hopefully sending a message to the developers to improve the handling of vector equations so that I don't have to reject a layout tool simply because of one thing it cannot do.

It's a shame - I have to use Tex now - which I don't mind. I like tex with all of it's suprise macros that save you when you struggle. The document has 13 chapters done in the odt file, I've got 2 done and the table of contents already in the Tex version, but I'm only working sporadically on the book as it's competing with other projects right now.

I apologize for my contentiousness towards you.

Last edited by LinuxPoser777; 12-29-2022 at 08:00 AM.
 
2 members found this post helpful.
Old 12-29-2022, 12:13 PM   #22
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 6,692
Blog Entries: 3

Rep: Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459Reputation: 3459
No worries.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Html that loads another html page on the same folder Ulysses_ Programming 6 12-01-2015 09:29 AM
html : force the fonts size for whole html page? Xeratul Programming 6 11-27-2012 12:54 PM
get console window width: why ioctl always return 0 width? karatelambda Programming 2 07-07-2010 08:57 AM
Adjust table width so that it fits to page width ynovh Programming 2 03-22-2010 04:13 PM
bash: how to resize and fix the width of a page.html ? frenchn00b Linux - General 1 03-10-2008 06:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration