File:  [LON-CAPA] / loncom / html / adm / help / tex / Print_Tricks.tex
Revision 1.6: download - view: text, annotated - select for diffs
Thu Sep 29 21:13:07 2005 UTC (18 years, 9 months ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_X, version_2_5_99_1, version_2_5_99_0, version_2_5_2, version_2_5_1, version_2_5_0, version_2_4_X, version_2_4_99_0, version_2_4_2, version_2_4_1, version_2_4_0, version_2_3_X, version_2_3_99_0, version_2_3_2, version_2_3_1, version_2_3_0, version_2_2_X, version_2_2_99_1, version_2_2_99_0, version_2_2_2, version_2_2_1, version_2_2_0, version_2_1_X, version_2_1_99_3, version_2_1_99_2, version_2_1_99_1, version_2_1_99_0, version_2_1_3, version_2_1_2, version_2_1_1, version_2_1_0, version_2_11_0_RC1, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, version_2_0_X, version_2_0_99_1, version_2_0_2, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, bz6209-base, bz6209, bz5969, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox, BZ4492-merge, BZ4492-feature_horizontal_radioresponse
- correcting tex errors

\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{The print rendition  of some Perl functions looks ugly }

In particular these functions are:
\begin{itemize}
   \item \&prettyprint
   \item \&dollarformat
   \item \&xmlparse
   \item \&chemparse
\end{itemize}


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,'$2f')</display>
</p>
\end{verbatim}

Note that the \texttt{<display>} tags must be tightly wrapped around the function call or
you will get a syntax error in web presentation mode.  For additional information
about cases where you must use \texttt{<display>}, see ``Variables with tags don't print
correctly'' below.


\emph{Image placement and alignment and text wrapping 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.  
Some of the common html tricks, using tables e.g. to control text wrapping around
figures, will not always work in print mode; especially if the text is to the
right side of the figure in the table.

The alignment choice 
affects whether or not the print rendering engine attempts to get text to wrap around the 
image.  With \texttt{align=``right''} or \texttt{align=``left''}, the print rendering engine
attempts to use the {\em wrapfigure} 
environment to place text around the figure at the
appropriate side.  If a figure is in a table, then the print engine, by default, 
the print engine will use wrapfigure, set the alignment to ``right'' 
unless you override it.  Otherwise, the default alignment is ``bottom'' as it 
is for html, and no wrapping will occur.  

\verb+\parpic+ style wrapping is also available by specifying \texttt{TeXwrap=``parpic''}
 in the <img> tag.  In some limited casese this gives a better result.


Other print specific <img> tag attributes are available. \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. When output,
those variables must be bracketed inside of \texttt{<display> </display>} tags.
 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>