GeneralImport to LaTex - multipage printing documents ?

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
omorr
Posts: 11
Joined: Sun Jan 14, 2007 3:48 pm

Import to LaTex - multipage printing documents ?

Post by omorr »

Dear all,

One of the thing (there are not too many :-) ) I can not find the satisfactory solution is Importing the documents from other software. For example, suppose that you want to make a tutorial for a particular software. If you want to keep the look of the original source document as much as possible as it looks in the source software, the working solution is to produce the appropriate "screenshot" like figure. The EPS produced figure will be, of course, easily imported into Latex. I found enough satisfactory to print to file using some PS printer in EPS mode from the source software.
This will be OK if the output could fit in a single printing page (we know the EPS is a single page figure). If the document consist of more than a single printing page, there is a way to print one by one single EPS page and import it into LaTex. And here the problem could arise.

How to organize multiple EPS figures which represents a single document? There are ways to keep them together one after another, and that is OK. But, if we like to organize our LaTex document with continuing EPS figures in a continuing fashion and to place them in the appropriate place, there is also solution with a "float" package, for instance. This might produce much empty spaces (mainly before the beginning of the first figure). Unfortunately, there is no solution like "longtable" which could spread over multiple page, and we have to play with splitting figures manually to perform this "continuing" task. This might be sometimes quite a nuisance. I think that there is no way in Latex to split the figure on two consequent printing page. If there is - please let me know.

Another way it could work might be to convert or save the source document in HTML (many software have this ability). By Googling or reading this forum I can not find how to convert HTML to Latex (have the impression that the opposite is more preffered). I found some HTML to LaTex converters but I have no experience with this. I wonder is there is a way to use HTML and import to LaTex with the requirements of keeping the look as close as possible as looking HTML in browser. Furthermore, as the HTML is markup language as TeX I wonder if there is a way to have imported multiple HTML page documents splitted (manually or automatic) in the apropriate places.

Is there are any other ways, please let me know. It would be much appreciated.

Sorry for this quite a long post, but I hope I made myself understood.

Regards,
Radovan

PS. At the moment I am preparing a book in LaTex on Numerical analysis and I need to import Mathcad documents throuought the text in a continuing fashion. I am using the explained EPS procedure for single or multiple printing page documents. I would like to have some more elegant way to do this.

Recommended reading 2024:

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

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

Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Import to LaTex - multipage printing documents ?

Post by Juanjo »

If you could convert the source document to pdf instead of EPS, you could use the pdfpages package. It allows to easily include multiple pages from the same pdf document and organize them in every printing page. For example, after loading such a package, a command like

Code: Select all

\includepdf[pages=-,nup=2x2]{foo.pdf}
includes all the pages of the file foo.pdf, putting 2 x 2 (logical) pages in every printing page.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
omorr
Posts: 11
Joined: Sun Jan 14, 2007 3:48 pm

Re: Import to LaTex - multipage printing documents ?

Post by omorr »

Of course, I complitelly forgot about this possibility.
Thank you very much for the hint and the package. I will try this instantly.

Regards,
Radovan
omorr
Posts: 11
Joined: Sun Jan 14, 2007 3:48 pm

Re: Import to LaTex - multipage printing documents ?

Post by omorr »

At the moment I am using my old home computer and MikTEX 2.0 (using it for years) and the pdfpages will not work with it (it needs newer pdftex version). As have to use it, I will use MikTEX 2.7 as soon as possible (installed at my office when back from vacation). Fortunately, there are many post here about pdf pages. In the meantime I have a question, until I try this myself.

By reading the posts and pdfpages documentation I am not sure if the inserted pdf multipage document could start at the begining of new paragraph (I suppose it could not) or it will start at the new page (I think this is the answer). Could you please tell me the behaviour of inserted pdf document concerning the position (where it is starting, where it is ending) in the Latex document. Is there a way to control this?

Regards,
Radovan
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Import to LaTex - multipage printing documents ?

Post by Juanjo »

omorr wrote: By reading the posts and pdfpages documentation I am not sure if the inserted pdf multipage document could start at the begining of new paragraph (I suppose it could not) or it will start at the new page (I think this is the answer). Could you please tell me the behaviour of inserted pdf document concerning the position (where it is starting, where it is ending) in the Latex document. Is there a way to control this?
It seems that the \includepdf command, defined in pdfpages, always starts a new page. The exact position of the included pdf pages on the printed sheet can be controlled through the many options that \includepdf accepts.

If you need to include pages in such a way that each page starts a new paragraph but not necessarily a new page, you may use a loop of \includegraphics commands. For example, suppose that you want to include from page 22 to page 35 of foo.pdf. The following code does the job:

Code: Select all

\newcounter{numpage}
\newcounter{firstpage}
\newcounter{lastpage}

\setcounter{firstpage}{22}
\setcounter{lastpage}{35}
\setcounter{numpage}{\value{firstpage}}
\stepcounter{lastpage}

\makeatletter
\@whilenum{\value{numpage}<\value{lastpage}}\do{%
  \includegraphics[page=\value{numpage},scale=0.5]{foo.pdf}\par
  \stepcounter{numpage}}
\makeatother
Of course, inside the optional argument of \includegraphics, you can place any suitable option. \@whilenum is an internal command of LaTeX with the following syntax:

Code: Select all

\@whilenum{condition}\do{commands}
. If you find inconvenient to put the loop between \makeatletter and \makeatother, write in the preamble

Code: Select all

\makeatletter
\let\WhileNum\@whilenum
\makeatother
You can now replace \@whilenum by \WhileNum and delete \makeatletter and \makeatother around the loop. The ifthen package provides a similar command:

Code: Select all

\whiledo{condition}{commands}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
omorr
Posts: 11
Joined: Sun Jan 14, 2007 3:48 pm

Re: Import to LaTex - multipage printing documents ?

Post by omorr »

Thank you Juanjo,

I think I could see your point and will try this as soon as possible.

Regards,
Radovan
Post Reply