Annotation of loncom/html/adm/help/tex/Print_Tricks.tex, revision 1.4

1.1       foxr        1: \label{Print_Tricks}
                      2: 
1.3       felicia     3: When you print a LON-CAPA resource, the XML of your resource is translated into
1.1       foxr        4: LaTeX.  The LaTeX is then processed and turned into a PDF document which can 
                      5: be displayed with your browser's Acrobat plugin and subsequently printed.
                      6: 
                      7: There are several problems that crop up both due to limitations in the XML to LaTeX
                      8: translation and due to differences in the model used by web browsers to render
                      9: HTML and LaTeX to compose print pages.  This document provides information
                     10: about some of these problems and, where possible, solutions, and tricks to work 
                     11: around them.  If you have a printing trick or a problem and would like to report 
                     12: it, please go to  http://bugs.lon-capa.org and register a bug report.
                     13: 
                     14: General information about printing within LonCAPA is also available: 
                     15: \ref{Print_Resource}
                     16: 
1.2       foxr       17: \emph{\&prettyprint and \&dollarformat look ugly}
                     18: 
1.1       foxr       19: To make these two functions work correctly within the print translator, it is
1.3       felicia    20: necessary to wrap them within a <display> tag.  For example:
1.1       foxr       21: 
                     22: \begin{verbatim}
                     23: <p>
1.4     ! felicia    24: If I had <display>&prettyprint(100,'$2f')</display>
1.1       foxr       25: </p>
                     26: \end{verbatim}
                     27: 
1.4     ! felicia    28: Note that the \texttt{<display>} tags must be tightly wrapped around the function call or
1.1       foxr       29: you will get a syntax error in web presentation mode.
                     30: 
                     31: 
1.2       foxr       32: \emph{Image placement and alignment is wrong}
                     33: 
1.1       foxr       34: Unfortunately this is due to a large difference between the LaTeX and HTML page
                     35: layout model.  In HTML images are placed exactly where you ask them to be placed.  
                     36: In LaTeX, images are considered {\em floats}, which LaTeX will place for you.
                     37: There are a few print options you can try to place images approximately where you 
                     38: want them relative to sorrounding text \ref{Print_Options}.
                     39: 
1.2       foxr       40: \emph{Variables with tags don't print correctly}
                     41: 
1.1       foxr       42: If a variable contains XML, in general it is necessary to force the XML parser
                     43: to make a pass over the contents of the contents of the variable prior to rendering
                     44: the section of the resource that contains that substitution.  For example:
                     45: 
                     46: \begin{verbatim}
1.2       foxr       47: <problem>
                     48: <script type="loncapa/perl">
                     49: $a = &xmlparse('<br />');
                     50: </script>
                     51: <startouttext />
                     52: <p>This is a break <display>$a</display> and then some more text</p>
                     53: <endouttext />
                     54: </problem>
                     55: \end{verbatim}
1.1       foxr       56: 
1.2       foxr       57: Without the xmlparse call and the display tag bracketing the variable, this
                     58: problem will display on the web just fine, but print incorrectly.
1.1       foxr       59: 
                     60: 
                     61: 

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