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

    1: \label{Print_Tricks}
    2: 
    3: When you print a LON-CAPA resource, the XML of your resource is translated into
    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: 
   17: \emph{The print rendition  of some Perl functions looks ugly }
   18: 
   19: In particular these functions are:
   20: \begin{itemize}
   21:    \item \&prettyprint
   22:    \item \&dollarformat
   23:    \item \&xmlparse
   24:    \item \&chemparse
   25: \end{itemize}
   26: 
   27: 
   28: To make these two functions work correctly within the print translator, it is
   29: necessary to wrap them within a <display> tag.  For example:
   30: 
   31: \begin{verbatim}
   32: <p>
   33: If I had <display>&prettyprint(100,'$2f')</display>
   34: </p>
   35: \end{verbatim}
   36: 
   37: Note that the \texttt{<display>} tags must be tightly wrapped around the function call or
   38: you will get a syntax error in web presentation mode.  For additional information
   39: about cases where you must use \texttt{<display>}, see ``Variables with tags don't print
   40: correctly'' below.
   41: 
   42: 
   43: \emph{Image placement and alignment and text wrapping is wrong}
   44: 
   45: Unfortunately this is due to a large difference between the LaTeX and HTML page
   46: layout model.  In HTML images are placed exactly where you ask them to be placed.  
   47: In LaTeX, images are considered {\em floats}, which LaTeX will place for you.  
   48: Some of the common html tricks, using tables e.g. to control text wrapping around
   49: figures, will not always work in print mode; especially if the text is to the
   50: right side of the figure in the table.
   51: 
   52: The alignment choice 
   53: affects whether or not the print rendering engine attempts to get text to wrap around the 
   54: image.  With \texttt{align=``right''} or \texttt{align=``left''}, the print rendering engine
   55: attempts to use the {\em wrapfigure} 
   56: environment to place text around the figure at the
   57: appropriate side.  If a figure is in a table, then the print engine, by default, 
   58: the print engine will use wrapfigure, set the alignment to ``right'' 
   59: unless you override it.  Otherwise, the default alignment is ``bottom'' as it 
   60: is for html, and no wrapping will occur.  
   61: 
   62: \verb+\parpic+ style wrapping is also available by specifying \texttt{TeXwrap=``parpic''}
   63:  in the <img> tag.  In some limited casese this gives a better result.
   64: 
   65: 
   66: Other print specific <img> tag attributes are available. \ref{Print_Options}.
   67: 
   68: 
   69: 
   70: \emph{Variables with tags don't print correctly}
   71: 
   72: If a variable contains XML, in general it is necessary to force the XML parser
   73: to make a pass over the contents of the contents of the variable prior to rendering
   74: the section of the resource that contains that substitution. When output,
   75: those variables must be bracketed inside of \texttt{<display> </display>} tags.
   76:  For example:
   77: 
   78: \begin{verbatim}
   79: <problem>
   80: <script type="loncapa/perl">
   81: $a = &xmlparse('<br />');
   82: </script>
   83: <startouttext />
   84: <p>This is a break <display>$a</display> and then some more text</p>
   85: <endouttext />
   86: </problem>
   87: \end{verbatim}
   88: 
   89: Without the xmlparse call and the display tag bracketing the variable, this
   90: problem will display on the web just fine, but print incorrectly.
   91: 
   92: 
   93: 

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