version 1.2, 2005/09/12 09:38:26
|
version 1.7, 2013/07/05 18:30:40
|
Line 1
|
Line 1
|
\label{Print_Tricks} |
\label{Print_Tricks} |
|
|
When you print a LonCAPA resource, the XML of your resource is translated into |
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 |
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. |
be displayed with your browser's Acrobat plugin and subsequently printed. |
|
|
Line 11 about some of these problems and, where
|
Line 11 about some of these problems and, where
|
around them. If you have a printing trick or a problem and would like to report |
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. |
it, please go to http://bugs.lon-capa.org and register a bug report. |
|
|
General information about printing within LonCAPA is also available: |
General information about printing within LonCAPA is also available in section |
\ref{Print_Resource} |
\ref{Print_Resource}. Some types of problems that may occur include: |
|
|
|
\null |
|
\noindent\textbf{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} |
|
|
\emph{\&prettyprint and \&dollarformat look ugly} |
|
|
|
To make these two functions work correctly within the print translator, it is |
To make these two functions work correctly within the print translator, it is |
necessary to wrap them within a <DISPLAY> tag. For example: |
necessary to wrap them within a \texttt{\textless display\textgreater} tag. For example: |
|
|
\begin{verbatim} |
\begin{verbatim} |
<p> |
<p> |
If I had <display>&dollarformat(100)</display> |
If I had <display>&prettyprint(100,'$2f')</display> |
</p> |
</p> |
\end{verbatim} |
\end{verbatim} |
|
|
Note that the <display> tags must be tightly wrapped around the function call or |
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. |
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. |
|
|
|
\null |
\emph{Image placement and alignment is wrong} |
\noindent\textbf{Image placement and alignment and text wrapping is wrong} |
|
|
Unfortunately this is due to a large difference between the LaTeX and HTML page |
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. |
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. |
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 |
Some of the common html tricks, using tables e.g. to control text wrapping around |
want them relative to sorrounding text \ref{Print_Options}. |
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. |
|
|
\emph{Variables with tags don't print correctly} |
|
|
Other print specific <img> tag attributes are available (see section \ref{Print_Options}). |
|
|
|
\null |
|
\noindent\textbf{Variables with tags don't print correctly} |
|
|
If a variable contains XML, in general it is necessary to force the XML parser |
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 |
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: |
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} |
\begin{verbatim} |
<problem> |
<problem> |
Line 57 $a = &xmlparse('<br />');
|
Line 89 $a = &xmlparse('<br />');
|
Without the xmlparse call and the display tag bracketing the variable, this |
Without the xmlparse call and the display tag bracketing the variable, this |
problem will display on the web just fine, but print incorrectly. |
problem will display on the web just fine, but print incorrectly. |
|
|
|
|
|
|