development version newLISP 8.7.

Started by Lutz, January 08, 2006, 03:28:51 PM

Previous topic - Next topic

eddier

#15
Nigel,



I somewhat cheat on this. There is generally a package of macros to do about anything you want in LaTeX. I don't write that many macros (depends on the project). I just usepackage{whatever} and use the commands from the manual provided. I also use LyX many times to get the main content in and then export the latex to tweak. I have written some tools usually in Python or newLISP to generate graphs in the {epic,eepic} picture environment, which is pretty easy.



Lutz,



This is going to take longer than I thought. Even when replacing HTML codes with LaTeX codes using the regular expression replacement in emacs, it is going to take some time. Also, the structure of the manual doesn't really match the structure of a document imposed by LaTeX. I worked on it a bit Friday night until the wife and I had to babysit our two year old granddaughter. Last night I start on a Quick Reference. After I complete a quick reference, I'll go back and tackle the main document which is now much bigger than I remember. I'm going to need more time on this than I previously thought.



Eddie

Lutz

#16
Don't stress, the PDF manual we have does a good job and is really made for printing 7x9 hard copies. On the computer people should use the hyperlinked HTML docs.



Of course if all that work results in a script I just have to run to get HTML and PDF than it is worth it and perhaps even faster than what I am doing now. But it would be too much if for every manual we would have to tweak stuff.



Lutz

eddier

#17
Actually a script to generate both the HTML version and a PDF file is what I would prefer doing. I'm doing something similar to this for the Factbook I generate here at the College. If I make this script, could we possibly generate two PDF documents instead of one (One for the main document and the other of a Quick Reference)? The reason is that parts, chapters, sections, and subsections are added to both the Bookmarks of a PDF file and the Table of Contents.



Eddie

Lutz

#18
A quick reference sounds like a good idea, having all functions with calling signatures on one sheet.  Once the script works I would edit the LaTex file directlly when adding/modifying content? What would I need on the MacOS X to run the script? Or is that stuff already default/UNIX installed. It could also be FreeBSD which is my ISP shell-account.



Lutz

eddier

#19
Are you using OSX?



If you are using Linux, the PDF and HTML files generated by the script would be portable across all platforms.



Eddie

eddier

#20
Actually, what I was thinking: create a file called manual.txt. Run the script

./doc.lsp quickref.txt

The output would be 3 files: "manual.html," "manual.pdf," and "qref.pdf." This might actually take a bit more thought?



We would just use short commands in manual.txt

.h 0 Introduction
.p this is a paragraph
.h 1 Section One
.h 2 Subsection
...


=>

<html>
<head>
<title>manual</title>
<style>
 ...
</style>
</head>
<body>
<h1>Contents</h1>
<ol type="I">
  <li>Introduction</li>
  <li>Section One</li>
...
</ol>
<p style="newpage">
<h1>Introduction</h1>
<p>this is a paragraph</p>
<h2>Section One</h2>
...


and



documentclass{article}
usepackage{newcent}
usepackage[hyperref stuff ...]{hyperref}
usepackage[margin=1in]{geometry}
...
begin{document}
tableofcontents
newpage
chapter{Introduction}

this is a pragraph

section{Section One}

...


We just need to define what codes we would need. Especially for the inline code sections. This is the reason I suggest building the quick reference first, to determine what codes we should have.



Eddie

Lutz

#21
If the only thing we gain is links in the PDF file than that looks like a lot of work and not worth it, thinking that hyperlinks are for computer viewing via HTML and PSF is for printing?



Editing a text file would be fine, as long as everything we do is with standard tools. I do  not want add new dependencies, incompatibilities etc.. The current method using HTML and OpenOffcie at least works on all platforms. We will do it but is has to be simple.



Lutz

eddier

#22
QuoteEditing a text file would be fine, as long as everything we do is with standard tools. I do not want add new dependencies, incompatibilities etc.. The current method using HTML and OpenOffcie at least works on all platforms. We will do it but is has to be simple.


By all means! The standard tools would be pdflatex, newlisp, and a text editor. Chances are pdflatex, newlisp, and a text editor are already on your machine ;)



Actually, this is very similar to a project I'm currently working on. So the lessons will carry from one project to the other. If no one minds, It'll take some time though.



Eddie[/quote]

cormullion

#23
I'm following this topic with great interest - I'd like to contribute somehow... Currently, though, I've been unable to install LaTeX on my machine (downloads are too big), so I may be of little use. But ask for any help anyway!

nigelbrown

#24
Hi all,

I've had some success generating a pdf with a hyperlinked Table of Contents using this tool chain:



1) import html manual into openoffice (2.0), save working file in openoffice format

2) generate a table of contents with included hyperlinks using openoffice functionality with hyperlink referencing selected

3) save this file as openoffice 1 format eg .sxw



4)here instead of using pdf output from openoffice I use Writer2Latex to generate a .tex file from the .sxw file - see http://www.hj-gym.dk/~hj/writer2latex/">http://www.hj-gym.dk/~hj/writer2latex/



5) open .tex file in TeXnicCenter (see http://www.texniccenter.org/front_content.php?idcat=50">http://www.texniccenter.org/front_content.php?idcat=50 - friendly but close to the bone if you want), removed all the /newline with text search and replace (were giving latex a problem) and click 'build and view current file' button to see the pdf (ignore the errors from latex engine the pdf opens and looks "OK").



The pdf (1,344 kB) does show some tweaking is needed eg trademark symbol, some font sizes are too big and cause wrapping in the syntax definitions etc but the hyperlinked table of contents is what I was looking for.



I'll put this first try pdf up for viewing for anyone interested - I've uploaded the pdf and sxw files to http://users.cyberone.com.au/nbrown/newlisp/newlisp_manual.pdf">http://users.cyberone.com.au/nbrown/new ... manual.pdf">http://users.cyberone.com.au/nbrown/newlisp/newlisp_manual.pdf and http://users.cyberone.com.au/nbrown/newlisp/newlisp_manual.sxw">http://users.cyberone.com.au/nbrown/new ... manual.sxw">http://users.cyberone.com.au/nbrown/newlisp/newlisp_manual.sxw .



Hope this may help. I tried Lyx before TeXnicCenter to import .tex but the relyx import process gave problems. I tried html2latex.c but it would need a tweaked definition file to get the html manual version in properly.

See http://www.math.vanderbilt.edu/~schectex/wincd/list_tex.htm">http://www.math.vanderbilt.edu/~schecte ... st_tex.htm">http://www.math.vanderbilt.edu/~schectex/wincd/list_tex.htm for good software links.



Nigel

eddier

#25
Will Nigel's solution work Lutz?  If it does I would like to make one suggestion. In the .tex file on the very next line after the documentclass{article or whatever} put

usepackage{newcent}

This will make the fonts much cleaner and enable you to copy and paste text from the manual (if you click the [T] button on the toolbar).



Eddie

nigelbrown

#26
Hi Eddie,

I tried putting in usepackage{newcent} in but it didn't change much - there possibly is something that needs to come out to let the package work. I tried taking out amsfonts but that didn't help. Anyone know the trick?



The pdf was a first try so perhaps changing use of styles, and by that fonts, in openoffice may help. Also in the long run letting latex do more and generating html and pdf etc from that may be the cleanest approach. Once a tidy latex file is achieved then Lyx may well import it cleanly and thus Lyx could be used as a friendlier editor.



Nigel

eddier

#27
If you can, show all of the stuff between documentclass{.... and begin{document}. Another suggestion is the ordering of the packages: try putting usepackage{newcent} as the last package before begin{document}



Eddie

nigelbrown

#28
Posted: http://users.cyberone.com.au/nbrown/newlisp/newlisp_manual.tex">http://users.cyberone.com.au/nbrown/new ... manual.tex">http://users.cyberone.com.au/nbrown/newlisp/newlisp_manual.tex



which is made by doing:

C:writer2latex04>w2l.bat newlisp_manual.sxw



This is Writer2LaTeX, Version 0.4 (2005-07-01)



Starting conversion...

Done!

C:writer2latex04>



Then loading as file into TexNicCenter and doing search&replace of newline to nothing (ie delete newline). This would remove a few valid formatting newlines but is a quick hack.



The .tex file upto begin{document} is :



% This file was converted to LaTeX by Writer2LaTeX ver. 0.4

% see http://www.hj-gym.dk/~hj/writer2latex">http://www.hj-gym.dk/~hj/writer2latex for more info

documentclass[12pt,twoside]{article}

usepackage[ascii]{inputenc}

usepackage[T1]{fontenc}

usepackage[english]{babel}

usepackage{amsmath,amssymb,amsfonts,textcomp}

usepackage{color}

usepackage{calc}

usepackage{longtable}

usepackage{hyperref}

hypersetup{colorlinks=true, linkcolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue}

% Text styles

newcommandtextstyleTeletype[1]{textrm{#1}}

newcommandtextstyleSourceText[1]{texttt{#1}}

% Outline numbering

setcounter{secnumdepth}{0}

% List styles

newcommandliststyleLii{%

renewcommandtheenumi{arabic{enumi}}

renewcommandlabelenumi{theenumi.}

renewcommandlabelitemi{{textbullet}}

renewcommandlabelitemii{{textbullet}}

renewcommandlabelitemiii{{textbullet}}

}

newcommandliststyleLiii{%

renewcommandtheenumi{arabic{enumi}}

renewcommandlabelenumi{theenumi.}

renewcommandlabelitemi{{textbullet}}

renewcommandlabelitemii{{textbullet}}

renewcommandlabelitemiii{{textbullet}}

}

newcommandliststyleLiv{%

renewcommandlabelitemi{{textbullet}}

renewcommandlabelitemii{{textbullet}}

renewcommandlabelitemiii{{textbullet}}

renewcommandlabelitemiv{{textbullet}}

}

newcommandliststyleLv{%

renewcommandtheenumi{arabic{enumi}}

renewcommandtheenumii{arabic{enumii}}

renewcommandtheenumiii{arabic{enumiii}}

renewcommandtheenumiv{arabic{enumiv}}

renewcommandlabelenumi{theenumi.}

renewcommandlabelenumii{theenumii.}

renewcommandlabelenumiii{theenumiii.}

renewcommandlabelenumiv{theenumiv.}

}

newcommandliststyleLvi{%

renewcommandtheenumi{arabic{enumi}}

renewcommandtheenumii{arabic{enumii}}

renewcommandtheenumiii{arabic{enumiii}}

renewcommandtheenumiv{arabic{enumiv}}

renewcommandlabelenumi{theenumi.}

renewcommandlabelenumii{theenumii.}

renewcommandlabelenumiii{theenumiii.}

renewcommandlabelenumiv{theenumiv.}

}

newcommandliststyleLvii{%

renewcommandlabelitemi{{textbullet}}

renewcommandlabelitemii{{textbullet}}

renewcommandlabelitemiii{{textbullet}}

renewcommandlabelitemiv{{textbullet}}

}

% Pages styles (master pages)

makeatletter

newcommandps@HTML{%

renewcommand@oddhead{}%

renewcommand@evenhead{}%

renewcommand@oddfoot{}%

renewcommand@evenfoot{}%

setlengthpaperwidth{20.999cm}setlengthpaperheight{29.699cm}setlengthvoffset{-1in}setlengthhoffset{-1in}setlengthtopmargin{1cm}setlengthheadheight{12pt}setlengthheadsep{0cm}setlengthfootskip{12pt+0cm}setlengthtextheight{29.699cm-1cm-1cm-0cm-12pt-0cm-12pt}setlengthoddsidemargin{2cm}setlengthtextwidth{20.999cm-2cm-1cm}

renewcommandthepage{arabic{page}}

setlength{skipfootins}{0.101cm}renewcommandfootnoterule{vspace*{-0.018cm}noindenttextcolor{black}{rule{0.25columnwidth}{0.018cm}}vspace*{0.101cm}}

}

makeatother

pagestyle{HTML}

setlengthtabcolsep{1mm}

renewcommandarraystretch{1.3}

title{newLISP v8.7.1 Manual and Reference}

begin{document}



Nigel

eddier

#29
I don't see any problems except that it is not loading the newcentury fonts.



You can kill the usepackage[ascii]{inputenc} and usepackage[T1]{fontenc} if you wish.



I even doubt wether you need the usepackage{amsmath,amssymb,amsfonts,textcomp} since I don't think there's probably any serious math stuff going on in the manual. I have never had any font troubles with these packages except for textcomp. I'm not sure what that one does.



add



usepackage{newcent}



where it will read



title{newLISP v8.7.1 Manual and Reference}

usepackage{newcent}

begin{document}



Now, pdflatex newlisp_manual.tex twice.

The first pass gets the information for the table of contents and the links

The second pass will put that information back into the pdf file.



The text shown in acrobat should be clean and copyable.



Eddie