File:  [LON-CAPA] / loncom / html / adm / help / tex / Print_Tricks.tex
Revision 1.3: download - view: text, annotated - select for diffs
Fri Sep 16 17:11:18 2005 UTC (18 years, 10 months ago) by felicia
Branches: MAIN
CVS tags: HEAD
Some very minor changes for manual consistancy.  Also, I replaced the &dollarformat example with a &prettyprint example because Guy told me that he would rather have users use &prettyprint(100,'$2f') instead of dollar format.

\label{Print_Tricks}

When you print a LON-CAPA resource, the XML of your resource is translated into
LaTeX.  The LaTeX is then processed and turned into a PDF document which can 
be displayed with your browser's Acrobat plugin and subsequently printed.

There are several problems that crop up both due to limitations in the XML to LaTeX
translation and due to differences in the model used by web browsers to render
HTML and LaTeX to compose print pages.  This document provides information
about some of these problems and, where possible, solutions, and tricks to work 
around them.  If you have a printing trick or a problem and would like to report 
it, please go to  http://bugs.lon-capa.org and register a bug report.

General information about printing within LonCAPA is also available: 
\ref{Print_Resource}

\emph{\&prettyprint and \&dollarformat look ugly}

To make these two functions work correctly within the print translator, it is
necessary to wrap them within a <display> tag.  For example:

\begin{verbatim}
<p>
If I had <display>&prettyprint(100,'3e')</display>
</p>
\end{verbatim}

Note that the <display> tags must be tightly wrapped around the function call or
you will get a syntax error in web presentation mode.


\emph{Image placement and alignment is wrong}

Unfortunately this is due to a large difference between the LaTeX and HTML page
layout model.  In HTML images are placed exactly where you ask them to be placed.  
In LaTeX, images are considered {\em floats}, which LaTeX will place for you.
There are a few print options you can try to place images approximately where you 
want them relative to sorrounding text \ref{Print_Options}.

\emph{Variables with tags don't print correctly}

If a variable contains XML, in general it is necessary to force the XML parser
to make a pass over the contents of the contents of the variable prior to rendering
the section of the resource that contains that substitution.  For example:

\begin{verbatim}
<problem>
<script type="loncapa/perl">
$a = &xmlparse('<br />');
</script>
<startouttext />
<p>This is a break <display>$a</display> and then some more text</p>
<endouttext />
</problem>
\end{verbatim}

Without the xmlparse call and the display tag bracketing the variable, this
problem will display on the web just fine, but print incorrectly.




FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>