From ef9ddae5d03bd4cc3eceda25fbbccc37f1554e93 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 9 Jul 2020 12:07:52 +0900 Subject: richtext update --- .../source/latex/richtext/doc/richtextman.tex | 1106 -------------------- texmf-dist/source/latex/richtext/richtext.dtx | 671 +++++++----- 2 files changed, 381 insertions(+), 1396 deletions(-) delete mode 100644 texmf-dist/source/latex/richtext/doc/richtextman.tex (limited to 'texmf-dist/source') diff --git a/texmf-dist/source/latex/richtext/doc/richtextman.tex b/texmf-dist/source/latex/richtext/doc/richtextman.tex deleted file mode 100644 index 7526f9ad..00000000 --- a/texmf-dist/source/latex/richtext/doc/richtextman.tex +++ /dev/null @@ -1,1106 +0,0 @@ -% makeindex < aebpro_man.idx > aebpro_man.ind -\documentclass[12pt]{article} -\usepackage[fleqn]{amsmath} -\usepackage[ - web={centertitlepage,designv,forcolorpaper,latextoc,pro,addtoHyOpts={pagebackref=false}}, - eforms, -% linktoattachments, - aebxmp -]{aeb_pro} -\usepackage{richtext} -\usepackage{graphicx,array} -%\usepackage{myriadpro} -%\usepackage{calibri} -\usepackage[altbullet]{lucidbry} - -%\previewtrue -%\usepackage{makeidx} -%\makeindex -\usepackage{acroman} -\usepackage[active]{srcltx} - -\setcounter{secnumdepth}{4} -\setcounter{tocdepth}{5} -\makeatletter -\renewcommand*{\theparagraph}{\texorpdfstring{\protect\P\protect\ }{\textparagraph}} -\renewcommand{\paragraph} - {\renewcommand{\@seccntformat}[1]{\theparagraph}% - \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\color{\aeb@subsubsectioncolor}\bfseries}} -\renewcommand*\l@paragraph{\@dottedtocline{4}{5.0em}{1em}} %{7.0em}{4.1em}} -\def\chgCurrLblName#1{\def\@currentlabelname{#1}} -\def\echgCurrLblName#1{\edef\@currentlabelname{#1}} -\makeatother - -\getDimsFromGraphic{graphics/dpsweb}{\dpswebW}{\dpswebH} - - -%\urlstyle{rm} -\urlstyle{sf} -\let\uif\textsf -\let\app\textsf -\def\psf#1{\textbf{\textsf{#1}}} -\let\amtIndent\leftmargini - -\convertcolorspec{named}{red}{RGB}{\rgbRed} -\convertcolorspec{named}{blue}{RGB}{\rgbBlue} -\convertcolorspec{named}{red}{HTML}{\htmlRed} -\convertcolorspec{named}{blue}{HTML}{\htmlBlue} -\convertcolorspec{named}{magenta}{RGB}{\rgbMagenta} -\convertcolorspec{named}{magenta}{HTML}{\htmlMagenta} -\convertcolorspec{named}{webbrown}{HTML}{\htmlWebBrown} - -\renewcommand*\descriptionlabel[1]{\hspace\labelsep - \normalfont #1} - - -\DeclareDocInfo -{ - university={Acro\negthinspace\TeX.Net}, - title={\textsf{richtext}: A method of creating rich text strings}, - author={D. P. Story}, - email={dpstory@acrotex.net}, - subject={Documentation for the richtext package from AcroTeX}, - talksite={\url{www.acrotex.net}}, - version={v1.0c, 2016/10/03}, - keywords={AcroTeX, rich text strings}, - copyrightStatus=True, - copyrightNotice={Copyright (C) \the\year, D. P. Story}, - copyrightInfoURL={http://www.acrotex.net} -} - -\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}% - \kern-.6em \hbox{$\mathcal S$}}$} - -\universityLayout{fontsize=Large} -\titleLayout{fontsize=LARGE} -\authorLayout{fontsize=Large} -\tocLayout{fontsize=Large,color=aeb} -\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb} -\subsectionLayout{indent=-31.25pt,color=aeb} -\subsubsectionLayout{indent=0pt,color=aeb} -\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}} - -\widestNumber{0.00.} -%\pagestyle{empty} -%\parindent0pt\parskip\medskipamount - -\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}% - \kern-.6em \hbox{$\mathcal S$}}$} - -\newcount\fldCnt \fldCnt=0 -\def\incFldCnt{\global\advance\fldCnt1\relax} - -\frenchspacing - -\chngDocObjectTo{\newDO}{doc} -\begin{docassembly} -var titleOfManual="The AeB RichText MANUAL"; -var manualfilename="Manual_BG_Print_richtext.pdf"; -var manualtemplate="Manual_BG_Brown.pdf"; // Blue, Green, Brown -var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate; -var doc; -var buildIt=false; -if ( buildIt ) { - console.println("Creating new " + manualfilename + " file."); - doc = \appopenDoc({cPath: _pathToBlank, bHidden: true}); - var _path=this.path; - var pos=_path.lastIndexOf("/"); - _path=_path.substring(0,pos)+"/"+manualfilename; - \docSaveAs\newDO ({ cPath: _path }); - doc.closeDoc(); - doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true}); - f=doc.getField("ManualTitle"); - f.value=titleOfManual; - doc.flattenPages(); - \docSaveAs\newDO({ cPath: manualfilename }); - doc.closeDoc(); -} else { - console.println("Using the current "+manualfilename+" file."); -} -var _path=this.path; -var pos=_path.lastIndexOf("/"); -_path=_path.substring(0,pos)+"/"+manualfilename; -\addWatermarkFromFile({ - bOnTop:false, - bOnPrint:false, - cDIPath:_path -}); -\executeSave(); -\end{docassembly} - -\begin{document} - -\maketitle - -\selectColors{linkColor=black} -\tableofcontents -\selectColors{linkColor=webgreen} - -\def\AcroT{Acro\!\TeX}\def\cAcroT{\textcolor{blue}{\AcroT}} -\def\AcroEB{\AcroT{} eDucation Bundle}\def\cAcroEB{\textcolor{blue}{\AcroEB}} -\def\AcroB{\AcroT{} Bundle}\def\cAcroB{\textcolor{blue}{\AcroB}} -\def\bUrl{http://www.math.uakron.edu/~dpstory} - -\hypersetup{linktocpage} - - -%FreeText -%/C[1.0 1.0 1.0]/Contents(This is test If there a real test, we would all be in trouble.) -%/CreationDate(D:20160909063701-05'00') -%/DA(0.898 0.1333 0.2157 rg /Helv 12 Tf) -%/DS(font: Helvetica,sans-serif 12.0pt; text-align:left; color:#E52237 ) -%/F 4/M(D:20160909065147-05'00')/NM(f8e9e6b1-1651-4c47-9169-8a47c7af23ff) -%/RC( -%

-% -% This is -% -% test -% -%If there a real test, we would all be in trouble. -%

)/Rect[30.1092 174.763 181.964 251.345]/Subj(Text Box)/Subtype/FreeText/T(dpstory)/Type/Annot>> - - -\section{Introduction} - -Rich text contents for variable text (text fields and editable combo boxes) -and markup annotations was introduced into the PDF specification beginning -with PDF 1.5 (\app{Acrobat} and \app{Adobe Reader} version~6). The rich text -strings are difficult to create for it requires reading from a number of -sources. The \pkg{richtext} package provides commands and documentation -needed to ``easily'' produce such rich strings. We demonstrate the results -using the \pkg{eforms} package (the text field produced by \pkg{hyperref} -does not support rich text). - -References for this material includes the \textsl{PDF -Reference}~\cite{book:pdfspec}, the XFA specification~\cite{webpage:XFASpec}, -and the CSS2 specification~\cite{webpage:CSS2}. Additionally, the \textsl{JavaScript for -Acrobat API Reference}~\cite{tech:AcroJS} covers the JavaScript API for -handling rich text content. - -\section{Preamble: Required packages and options} - -The package has no options and only requires \pkg{xkeyval} and \pkg{ifxetex} packages. -The package can produce rich text strings, but to actually use them, you'll need -the \pkg{eforms} package. - -The package works for all drivers \app{dvips}, \app{pdflatex}, \app{xelatex}, -and \app{luatex}. The \pkg{eforms} package can automatically detect all -drivers except \pkg{dvips}, and that is used by default. - -\section{Creating rich text strings}\label{s:CreateRTS} - -We begin by illustrating the result of the \pkg{richtext} package, consider the rich text field below. - -\rtpara[indent=first]{para1}{Now is the time for -\span{style={bold,italic,strikeit},color=ff0000}{J\374rgen} and all -good men to come to the aid of \it{their} \bf{country}. Now is the time for -\span{style=italic}{all good} women to do the same.} -\rtpara[indent=first]{para2}{With rich text, we can format the text within -the text field. As a reader of this rich text field, you can edit the -contents of the box, feel free to do so.} -\rtpara[halign=right]{para3}{D. P. Story \span{url=http://www.acrotex.net}{AcroTeX.Net}} - -\setRVVContent{myContent}{{para1}{para2}{skipline}{para3}} - -\begin{center} -%\previewtrue -\incFldCnt -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}%\DS{\useDS{myDS}}% -\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{4in}{10\baselineskip} -\end{center} - -To edit the field above, click in the field, press \uif{Ctrl+E} or \uif{Cmd+E} (for \app{Mac OS}) to obtain -the \uif{Form Field Text Properties} toolbar. By pressing the \uif{More} button, you can see the additional -properties of the field, as seen in \hyperref[fig:FPtabs]{Figure~\ref*{fig:FPtabs}}. - - -A rich text may have any of several style attributes, many of these are illustrated in the above example. -As a guide to introducing the attributes, we follow the \uif{Form Field Text Properties} dialog box shown -in \hyperref[fig:FPtabs]{Figure~\ref*{fig:FPtabs}}. - -\begin{figure}[htb]\centering\setlength{\fboxsep}{0pt}% -\fbox{\parbox{.5\linewidth-5pt-2\fboxrule}{\includegraphics[width=\linewidth]{graphics/fontprops}}}\hspace{10pt}% -\fbox{\parbox{.5\linewidth-5pt-2\fboxrule}{\includegraphics[width=\linewidth]{graphics/paragraphprops}}}\\[6pt] -\fbox{\parbox{.8\linewidth-2\fboxrule}{\includegraphics[width=\linewidth]{graphics/linkprops}}}% -\caption{The Font, Paragraph and Link tabs}\label{fig:FPtabs} -\end{figure} - -\newtopic\noindent -The basic command for creating a rich text \emph{paragraph} is \cs{rtpara}: -\bVerb\takeMeasure{\string\rtpara[\ameta{Para-Font-attrs}]\darg{\ameta{name}}\darg{\ameta{rich-text-paragraph}}}% -\begin{dCmd}[commandchars=!()]{\bxSize} -\rtpara[!ameta(Para-Font-attrs)]{!ameta(name)}{!ameta(rich-text-paragraph)} -\end{dCmd} -\eVerb where \ameta{Para-Font-attrs} are key-value pairs (in the {\LaTeX} -sense) that are described in \hyperref[s:FLtabs]{Sections~\ref*{s:FLtabs}} -and~\ref{s:Paratab}; these attributes are applied to the paragraph as a -whole. The \ameta{name} is a unique name to be associated with -\ameta{rich-text-paragraph} so it can be referenced later from within a text -field. There are two types of attributes: \uif{Font} and \uif{Paragraph}, as -guided by \hyperref[fig:FPtabs]{Figure~\ref*{fig:FPtabs}}. For convenience, -the \uif{Link} attributes (URLs) are classified as \uif{Font}. The optional -argument of \cs{rtpara} consists of usually \uif{Paragraph} attributes, most -\uif{Font} attributes are also recognized. - -The definition of the first paragraph of the above rich text field reads as -follows: -\begin{Verbatim}[fontsize=\small] -\rtpara[indent=first]{para1}{Now is the time for - \span{style={bold,italic,strikeit},color=ff0000}{J\374rgen} - and all good men to come to the aid of \it{their} - \bf{country}. Now is the time for \span{style=italic} - {all good} women to do the same.} -\end{Verbatim} -In this example, the optional argument for \cs{rtpara} was used to indent the -paragraph. The rich text defined here is named \texttt{para1}. The third -argument, \ameta{rich-text-string}, consists of ordinary text, the \cs{span} -command used to insert special formatting for text, and certain other -`short-cut' markups like \cs{it} and \cs{bf}. Note that the umluat (\"{u}) is -expressed as octal (\cs{374}). - -The \cs{span} command is used to format individual sentence fragments. Its -syntax is, -\bVerb\takeMeasure{\string\span\darg{\ameta{Font-attrs}}\darg{\ameta{rich-text-string}}}% -\begin{dCmd}[commandchars=!()]{\bxSize} -\span[!ameta(Font-attrs)]{!ameta(rich-text-string)} -\end{dCmd} -\eVerb where \ameta{Font-attrs} are \uif{Font} attributes as described in -\hyperref[s:FLtabs]{Sections~\ref*{s:FLtabs}}; these attributes are applied -to the string \ameta{rich-text-string} only. The \cs{span} command, as -described here, is only defined within the third argument -(\ameta{rich-text-paragraph}) of \cs{rtpara}. This is necessary because -\cs{span} is a {\TeX} primitive command, and we must not overwrite its -definition. - -When you create a \emph{rich text string} there is a parallel development of a -\emph{plain text string}, the string without its rich text markup, these two -(rich and plain strings) are used to populate the values of the \psf{RV} and -\psf{V} keys of a text field. When you define a rich text paragraph string -under its own \ameta{name}, you can typeset it (to check the syntax) and its -plain text counterpart using the \cs{useRV\darg{\ameta{name}}} and -\cs{useV\darg{\ameta{name}}} commands. For example, -\begin{quote}\raggedright\ttfamily\makeatletter\def\rt@SC{;\penalty0}% -\rtpara[indent=first]{para1}{Now is the time for -\span{style={bold,italic,strikeit},color=ff0000}{J\string\374rgen} and all -good men to come to the aid of \it{their} \bf{country}. Now is the time for -\span{style=italic}{all good} women to do the same.} -\makeatother -\hspace*{-\leftmargini}\textbf{\cs{useRV\darg{para1}:}}\ \useRV{para1}\\[\baselineskip] -\hspace*{-\leftmargini}\textbf{\cs{useV\darg{para1}:}}\ \useV{para1} -\end{quote} -These commands may also be used to insert the strings into the \psf{RV} and -\psf{V} keys, respectively; though the \pkg{richtext} package offers an -alternative technique. - -\subsection{The \texorpdfstring{\uif{Font}}{Font} and -\texorpdfstring{\uif{Link}}{Link} tabs}\label{s:FLtabs} - -In this section, we cover the \uif{Font} and \uif{Link} tabs, as well as other attributes -not listed on any tab. - -\subsubsection{The \texorpdfstring{\uif{Font}}{Font} tab} - -We discuss the \uif{Font} tab of \hyperref[fig:FPtabs]{Figure~\ref*{fig:FPtabs}}. The -key-value for each of the attributes is given and described briefly. These key-values -may appear as \ameta{Font-attrs} or \ameta{Para-Font-attrs}. -\begin{description} -%The font family used to draw the text. It is an array of family names to be searched for in order. The first -%entry in the array is the font name of the font to use. The second entry is an optional generic family name -%to use if an exact match of the first font is not found. The generic family names are -%symbol, serif, sans-serif, cursive, monospace, fantasy -%The default generic family name is sans-serif. -\item[\uif{Font:}] \texttt{font=\ameta{font\_name}} A font name or a list of - font names to be used to display the enclosed text. The first - entry is the font name of the font to use. The second font name is - typically a generic family name to use if an exact match is not found. - The generic family names are \texttt{symbol}, \texttt{serif}, - \texttt{sans-serif}, \texttt{cursive}, \texttt{monospace}, and - \texttt{fantasy}. The default is \texttt{sans-serif}. If a typeface name - contains white space, enclose it within single quotes (\texttt{'}). -\begin{flushleft}\small %\previewtrue -\verb|\rtpara[font={Arial,sans-serif}]{para1}{This is Arial or a| -\hspace*{20pt}\verb|san-serif substitute.}|\\[3pt] -\rtpara[font={Arial,sans-serif}]{para1}{This is Arial or a san-serif substitute.}% -\incFldCnt\textField[\Ff{\FfRichText}%\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp}\\[6pt] -\verb|\rtpara{para2}{This is \span{font='Myriad Pro'}| -\hspace*{20pt}\verb|{Myriad Pro} font.}|\\[3pt] -\rtpara{para2}{This is \span{font='Myriad Pro'}{Myriad Pro} font.} -\incFldCnt\textField[\Ff{\FfRichText}%\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para2}}\V{\useV{para2}}]{rtFld\the\fldCnt}{3in}{16bp} -\end{flushleft} -In the second example, only `Myriad Pro' is actually set in the Myriad Pro font; the rest of the sentence -is typeset in the default font, Helvetica in this case. Use \uif{Ctrl+E} (\uif{Cmd+E}) to inspect the properties -of these two fields and verify the fonts are Arial, Myriad Pro, and Helvetica. - -\item[\uif{Size}:] \texttt{size=\ameta{dec\_num}} The size of the font to - be used. The value of \texttt{size} is \ameta{dec\_num}, a (positive) - decimal number. -\begin{flushleft}\small %\previewtrue -\verb|\rtpara[size=12]{para1}{This is 12pt font, while| -\hspace*{20pt}\verb|\span{size=8}{this is 8pt font.} OK?}|\\[6pt] -\rtpara[size=12]{para1}{This is 12pt font, while \span{size=8}{this is 8pt font.} OK?} -\incFldCnt\textField[\Ff{\FfRichText}%\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp} -\end{flushleft} - -\item[\uif{Baseline Shift:}] \texttt{raise=\ameta{def\_num}} The position of the baseline of the text is determined -by the \texttt{raise} key. \texttt{raise=6.6} raises the baseline \texttt{6.6pt}, while \texttt{raise=-4} lowers -it \texttt{4pt}. -\begin{flushleft}\small -\verb|\rtpara{para1}{This text \span{raise=6.6}{is raised by| -\hspace*{20pt}\verb| 6.6pt} while this text \span{raise=-4}| -\hspace*{20pt}\verb|{is lowed by 4pt.} Back to normal baselines.}|\\[6pt] -\rtpara{para1}{This text \span{raise=6.6}{is raised by 6.6pt} while this text -\span{raise=-4}{is lowed by 4pt.} Back to normal baselines.} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp*4} -\end{flushleft} - -\item[\uif{Underline:}] - \texttt{ulstyle=\ameta{\upshape{none|ul|2ul|wul|2wul}}} The - \texttt{ulstyle} key determines the style of underlining, possible values - are \texttt{none} (no underlining), \texttt{ul} (underlining), - \texttt{2ul} (double-line underlining), \texttt{wul} (word underlining), - and \texttt{2wul} (double-line word underlining). -\begin{flushleft}\small %\previewtrue -\verb|\rtpara{para1}{We can \span{ulstyle=ul}{underline in a}| -\hspace*{20pt}\verb|\span{ulstyle=2ul}{number of different ways}| -\hspace*{20pt}\verb|\span{ulstyle=wul}{that catch the}| -\hspace*{20pt}\verb|\span{ulstyle=2wul}{attention of the reader}.|\\[3pt] -\rtpara{para1}{We can \span{ulstyle=ul}{underline in a} \span{ulstyle=2ul}{number of different ways} -\span{ulstyle=wul}{that catch the} \span{ulstyle=2wul}{attention of the reader}.} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp*4} -\end{flushleft} - -\item[\uif{Style}:] - \texttt{style=\darg{\upshape{[bold,][italic,][strikeit]}}} Unlike some - of the other (choice) keys, the value of the \texttt{style} key is any - \emph{subset} of the values listed: for example, \texttt{style=bold} - paints the underlying text in bold, \texttt{style=\darg{bold,italic}} - yields bold-italic font, and, for a final example, - \texttt{style=\darg{italic,strikeit}} typesets its text in - strike-through italic. Multiple values must be enclosed in braces - (\darg{}) so that \pkg{xkeyval} can correctly parse them. -\begin{flushleft}\small %\previewtrue -\verb|\rtpara{para1}{To \span{style=bold}{boldly to go} where| -\hspace*{20pt}\verb|\span{style={bold,italic}}{no man has gone}| -\hspace*{20pt}\verb|\span{style={italic,strikeit}}{prior}| -\hspace*{20pt}\verb|\span{style={italic,bold}}{before.}|\\[3pt] -\rtpara{para1}{To \span{style=bold}{boldly to go} where -\span{style={bold,italic}}{no man has gone} -\span{style={italic,strikeit}}{prior}\span{style={italic,bold}}{before.}} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp*2} -\end{flushleft} - -\item[\uif{Color:}] - \texttt{color=\ameta{\upshape{\meta{rrggbb}|\darg{rgb(\meta{rrr,ggg,bbb})}}}} - Use this key to color the effected text. There are two - methods of defining color: -\begin{itemize} - \item[(1)] \meta{rrggbb} uses a 2-digit hexadecimal - value for each component; - \item[(2)] \texttt{rgb(\meta{rrr,ggg,bbb})} uses a decimal - value (0--255) for each component. -\end{itemize} - Because the second form contains - commas, it must necessarily be enclosed in braces (\darg{}) to be - correctly parsed by \pkg{xkeyval}. -\begin{flushleft}\small %\previewtrue -\verb|\rtpara{para1}{This is \span{color={rgb(255,0,0)}}{red} and| -\hspace*{20pt}\verb|this is \span{color=0000ff}{blue}.| -\rtpara{para1}{This is \span{color={rgb(255,0,0)}}{red} and this is \span{color=0000ff}{blue}.}\\[3pt] -\incFldCnt\textField[\Ff{\FfRichText}%\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp} -\end{flushleft} -Things are not as bad as it seems. The \pkg{xcolor} package has the -wonderful command \cs{convertcolorspec} that converts colors between color -models. For example, we might define: -\begin{Verbatim}[fontsize=\small] -\convertcolorspec{named}{red}{RGB}{\rgbRed} -\convertcolorspec{named}{blue}{HTML}{\htmlBlue} -\convertcolorspec{named}{magenta}{RGB}{\rgbMagenta} -\convertcolorspec{named}{magenta}{HTML}{\htmlMagenta} -\end{Verbatim} -We can then use these named colors. -\begin{Verbatim}[fontsize=\small] -\rtpara{para1}{This is \span{color={rgb(\rgbRed)}}{red} and -this is \span{color=\htmlBlue}{blue}. We can do magenta two -ways, using \span{color={rgb(\rgbMagenta)}}{decimal -components} or using \span{color=\htmlMagenta}{hexadecimal -components}.} -\end{Verbatim} -\rtpara{para1}{This is \span{color={rgb(\rgbRed)}}{red} and this -is \span{color=\htmlBlue}{blue}. We can do magenta two ways, -using \span{color={rgb(\rgbMagenta)}}{decimal components} or -using \span{color=\htmlMagenta}{hexadecimal components}.}\par\smallskip -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp*4}\\[6pt] -% -Notice that \verb|color={rgb(\rgbMagenta)}|, the value of \texttt{color}, is -still enclosed in braces since the expansion of \cs{rgbMagenta} contains -commas. -\end{description} - -\subsubsection{The \texorpdfstring{\uif{Link}}{Link} tab} - -We can create a link within rich text by using the \texttt{url} key from within -the first argument of the \cs{span} command. The syntax is \texttt{url=\ameta{URL}}. -\begin{Verbatim}[fontsize=\small] -\rtpara{para1}{Visit me at \span{url={http://www.acrotex.net}, - font='Courier New'}{http://www.acrotex.net}} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{Visit me at \span{url={http://www.acrotex.net},font='Courier New'}{http://www.acrotex.net}}\par\smallskip -\incFldCnt\textField[\Ff{\FfRichText}%\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp} -\end{quote} -It appears the \app{Acrobat/Reader} applications format a URL in underlined blue. We can override this however. -\begin{Verbatim}[fontsize=\small] -\rtpara{para1}{Visit me at \span{url={http://www.acrotex.net}, - color=\htmlMagenta,ulstyle=none,font='Courier New'} - {http://www.acrotex.net}} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{Visit me at \span{url={http://www.acrotex.net}, - color=\htmlMagenta,ulstyle=none,font='Courier New'} - {http://www.acrotex.net}} -\par\smallskip -\incFldCnt\textField[\Ff{\FfRichText}%\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp} -\end{quote} -Special characters are no problem, with the exception of wrapping a long URL -around to a different line (usually needed for display purposes): -\begin{Verbatim}[fontsize=\small] -\rtpara{para1}{Visit me at - \span{url={http://www.math.uakron.edu/~dpstory/% - acrotex.html#technical}}{AcroTeX at The University - of Akron}} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{Visit me at \span{url={http://www.math.uakron.edu/% - ~dpstory/acrotex.html#technical}} - {AcroTeX at The University of Akron}}\par\smallskip -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp*2} -\end{quote} - -\subsubsection{Miscellaneous markup of the \texorpdfstring{\uif{Font}}{Font} classification} - -There are several other attributes that are not key-values, but are -implemented through {\LaTeX} commands. - -\paragraph[Bold and italic]{Bold and italic.}\chgCurrLblName{Bold and italic}\label{para:BandI} -There are a couple of XHTML -elements that can also be used for bold and italic. -\begin{itemize} - \item \cs{bf\darg{\ameta{text}}} expands to \texttt{\ameta{text}} and places - \ameta{text} in bold font. May be used within a \cs{span} command. - \item \cs{it\darg{\ameta{text}}} expands to \texttt{\ameta{text}} and places - \ameta{text} in italic font. May be used within a \cs{span} command. -\end{itemize} -Both \cs{bf} and \cs{it} are local commands, undefined outside of the third argument -of \cs{rtpara}. Do not code \texttt{\ameta{text}} or \texttt{\ameta{text}} -directly, rather, always use the {\LaTeX} commands \cs{bf} and \cs{it}. \cs{bf} and \cs{it} may be nested. -\begin{Verbatim}[fontsize=\small] -\rtpara{para1}{We \bf{boldly} say that \it{italic} is used for -emphasis, but both \bf{\it{drive home the point}}.} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{We \bf{boldly} say that \it{italic} is used for emphasis, -but both \span{color=\htmlBlue}{\bf{\it{drive home the point}}}.} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp*2} -\end{quote} - -\paragraph[Subscripts and superscripts]{Subscripts and superscripts.}% -\chgCurrLblName{Subscripts and superscripts}\label{para:SubSup} -Subscripts and superscripts are implemented through -{\LaTeX} commands \cs{sub} and \cs{sup}. -\begin{itemize} - \item \cs{sub\darg{\ameta{text}}} expands to - \texttt{\ameta{text}} and places \ameta{text} as a - subscript. - \item \cs{sup\darg{\ameta{text}}} expands to - \texttt{\ameta{text}} and places \ameta{text} as a - superscript. -\end{itemize} -Both \cs{sub} and \cs{sup} are local commands, undefined outside of the third argument -of \cs{rtpara}. Do not code these raw markups, rather always use \cs{sub} and \cs{sup}. -\begin{Verbatim}[fontsize=\small] -\rtpara{para1}{When we compile $x_2^3$ we get -\it{x}\sub{2}\sup{3}, nicely typeset or would you prefer -\it{x}\sup{3}\sub{2}?} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{When we compile $x_2^3$ we get \it{x}\sub{2}\sup{3}, nicely typeset - or would you prefer \it{x}\sup{3}\sub{2}?} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp*5/2} -\end{quote} - - - -\subsection{The \texorpdfstring{\uif{Paragraph}}{Paragraph} tab}\label{s:Paratab} - -We begin by following the \uif{Paragraph} tab of -\hyperref[fig:FPtabs]{Figure~\ref*{fig:FPtabs}}. The top-most region on the \uif{Paragraph} tab -is labeled \uif{Alignment}. It consists of two separated regions, the one on the left is \emph{Horizontal Alignment}, -the one on the right is \emph{Vertical Alignment}. -\begin{description} - \item[\uif{Alignment}:]\leavevmode - \begin{description} - \item[Horizontal Alignment:] \texttt{halign=\ameta{\upshape{left|center|right|justify}}}\\The meaning of these - key-values are obvious, we'll illustrate with examples. -\begin{Verbatim}[fontsize=\small] -\rtpara[halign=left]{para1}{This paragraph is left - aligned or flush left. Let's have a few more words - to wrap around.} -\rtpara[halign=center]{para2}{This paragraph is - centered. Let's have a few more words to wrap - around.} -\rtpara[halign=right]{para3}{This paragraph is right - aligned or flush right. Let's have a few more words - to wrap around.} -\rtpara[halign=justify]{para4}{This paragraph is - justified. Space between words are stretched a - little to make this happen. It is adequate for - our purposes.} -\end{Verbatim} -\begin{flushleft} -\rtpara[halign=left]{para1}{This paragraph is left aligned or flush left. Let's have a few more words to wrap around.} -\rtpara[halign=center]{para2}{This paragraph is centered. Let's have a few more words to wrap around.} -\rtpara[halign=right]{para3}{This paragraph is right aligned or flush right. Let's have a few more words to wrap around.} -\rtpara[halign=justify]{para4}{This paragraph is justified. Space - between words are stretched a little to make this happen. It is adequate for our purposes.} -\setRVVContent{myContent}{{para1}{skipline}{para2}{skipline}{para3}{skipline}{para4}} %{skipline} -\setDefaultStyle{myDS}{font={Helvetica,sans-serif},size=10,color=000000}\par\medskip -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDS{myDS}}\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{3in}{12bp*12} -\end{flushleft} -Horizontal alignment is applied to individual paragraph, unlike vertical alignment. - - \item[Vertical Alignment:] - \texttt{valign=\ameta{\upshape{top|middle|bottom}}} Again, - we shall illustrate by example. -\begin{Verbatim}[fontsize=\small] -\rtpara[valign=top]{para1}{This paragraph is vertically - aligned at the top.} -\rtpara[valign=middle]{para2}{This paragraph is - vertically aligned at the middle.} -\rtpara[valign=bottom]{para3}{This paragraph is - vertically aligned at the bottom.} -\end{Verbatim} -\begin{flushleft} -\rtpara[valign=top]{para1}{This paragraph is vertically aligned at the top.} -\rtpara[valign=middle]{para2}{This paragraph is vertically aligned at the middle.} -\rtpara[valign=bottom]{para3}{This paragraph is vertically aligned at the bottom.} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{1.5in}{16bp*5}\kern4bp -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para2}}\V{\useV{para2}}]{rtFld\the\fldCnt}{1.5in}{16bp*5}\kern4bp -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para3}}\V{\useV{para3}}]{rtFld\the\fldCnt}{1.5in}{16bp*5}\par\medskip -\end{flushleft} -The \texttt{valign} key seems to apply to all paragraphs in the rich text form field, as illustrated below. -\begin{flushleft} -\setRVVContent{myContent}{{para1}{skipline}{para2}{skipline}{para3}}\par\smallskip %{skipline} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{4in}{16bp*8}\par\smallskip -\setRVVContent{myContent}{{para2}{skipline}{para1}{skipline}{para3}}\par\smallskip %{skipline} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{4in}{16bp*8} -\end{flushleft} -The vertical alignment for the whole rich text field obeys the \texttt{valign} key of the first paragraph. - - \item[\uif{Indents:}] Through the \uif{Indents} region of the \uif{Paragraph} tab, left and right margins may be set, - as well as the amount of indent. - \begin{description} - \item[\uif{Left:}] \texttt{margleft=\darg{dec}} The value of \darg{dec} is a nonnegative decimal number, it represents - the number of points to make the left margin. - \item[\uif{Right:}] \texttt{margright=\darg{dec}} The value of \darg{dec} is a nonnegative decimal number, it represents - the number of points to make the right margin. - -\medskip - Below is an example for both \texttt{margleft} and \texttt{margright}. -\begin{Verbatim}[fontsize=\small] -\rtpara[margleft=10,margright=40,halign=justify - ]{para1}{This is the first paragraph, it has - a left margin of 10pt and a right margin of - 40pt.} -\rtpara[halign=justify]{para2}{This is the second - paragraph. We demonstrate that the left and - margins can be applied separately to - paragraphs.} -\end{Verbatim} -\begin{flushleft} -\rtpara[font=10,margleft=10,margright=40,halign=justify]{para1}{This is the first -paragraph, it has a left margin of 10pt and a right margin of 40pt.} -\rtpara[font=10,halign=justify]{para2}{This is the second paragraph. We demonstrate that the -left and margins can be applied separately to paragraphs.} -\setRVVContent{myContent}{{para1}{skipline}{para2}}\par\smallskip %{skipline} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{4in}{14bp*6} -\end{flushleft} - -\medskip -\item[\uif{First \& By:}] Two key-values: \texttt{indent=\ameta{\upshape{none|first|hanging}}} \& \texttt{indentby=\ameta{dec}} - When \texttt{indent} key is set to \texttt{indent=first}, the first line is indented by an amount of \texttt{\ameta{dec}pt}; similarly, - if \texttt{indent=hanging}, there is a hang indent on the first line by an amount of \texttt{-\ameta{dec}pt} - (the minus sign (\texttt{-}) is automatically applied. The default indent amount it \texttt{12pt}.\smallskip\kern0pt -\begin{Verbatim}[fontsize=\small] -\rtpara[indent=first]{para1}{This paragraph is - indented by the default amount of 12pt.} -\rtpara[indent=first,indentby=24]{para2}{In this - second paragraph, we indent by 24pt, twice - as wide as the default.} -\rtpara[indent=hanging]{par3}{Here we have a third - paragraph, separated from the other two, with - the default hanging indentation.} -\end{Verbatim} -\begin{flushleft} -\rtpara[indent=first]{para1}{This paragraph is indented by the default amount of 12pt.} -\rtpara[indent=first,indentby=24]{para2}{In this second paragraph, we indent by 24pt, twice as wide as the default.} -\rtpara[indent=hanging]{para3}{Here we have a third paragraph, separated from the other two, with -the default hanging indentation.}\par\smallskip -\setRVVContent{myContent}{{para1}{para2}{skipline}{para3}}\par\smallskip %{skipline} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{3.5in}{16bp*15/2}\par\smallskip -\end{flushleft} - - \end{description} - -\goodbreak - \item[\uif{Spacing:}] - \begin{description} - \item[\uif{Above:}] \texttt{margtop=\ameta{dec}} A value of \ameta{dec} (positive, negative, or zero) adds - vertical space \emph{above} the paragraph.\medskip -\begin{Verbatim}[fontsize=\small] -\rtpara[margtop=12]{para1}{We put 12pt of extra - space above this paragraph.} -\rtpara[margtop=24]{para2}{Extra space above this - paragraph (24pt).} -\end{Verbatim} -\begin{flushleft} -\rtpara[margtop=12]{para1}{We put 12pt of extra space above this paragraph.} -\rtpara[margtop=24]{para2}{Extra space above this paragraph (24pt).} -\setRVVContent{myContent}{{para1}{para2}}\par\medskip %{skipline} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{3.5in}{16bp*6}\par\smallskip -\end{flushleft} - - \item[\uif{Below:}] \texttt{margbottom=\ameta{dec}} A value of \ameta{dec} (positive, negative, or zero) adds - vertical space below the paragraph.\par\medskip -\begin{Verbatim}[fontsize=\small] -\rtpara[valign=bottom,margbottom=12]{para1}{We put - \span{font=Courier,style=bold}{valign=bottom}, - but bring the paragraph up 12pt from there.} -\end{Verbatim} -\rtpara[valign=bottom,margbottom=12]{para1}{We put \span{font=Courier,style=bold}{valign=bottom}, but bring the -paragraph up 12pt from there.}\par\medskip -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp*6} - -\medskip\goodbreak - \item[\uif{Line Spacing}] Sets the amount of vertical space between baselines. The key-values are -\begin{equation*} - \texttt{linespacing=\ameta{\upshape{single|oneandhalf|double|exact}}} -\end{equation*} - When \texttt{linespacing=exact}, use - \texttt{lineheight=\ameta{dec}} to set the space between baselines. -\begin{flushleft} -\rtpara[linespacing=oneandhalf]{para1}{This -paragraph has line spacing of oneandhalf. We will prattle on to get -some wraparound to the next line.} -\rtpara[linespacing=double]{para2}{This paragraph has double spacing. Once again, we'll -ramble, not prattle, on for several more words.} -\rtpara[linespacing=exact,lineheight=30]{para3}{Let's see what we get here, with -linespacing=exact, lineheight=30. Do we get significant separation between sentences?} -\setRVVContent{myContent}{{para1}{para2}{para3}}\par\medskip %{skipline} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{\linewidth-2bp}{16bp*12}\par\medskip -\end{flushleft} - -The paragraph declarations for the above rich text field are, -\begin{Verbatim}[fontsize=\small] -\rtpara[linespacing=oneandhalf]{para1}{This - paragraph has line spacing of oneandhalf. We - will prattle on to get some wraparound to the - next line.} -\rtpara[linespacing=double]{para2}{This paragraph - has double spacing. Once again, we'll ramble, - not prattle, on for several more words.} -\rtpara[linespacing=exact,lineheight=30]{para3} - {Let's see what we get here, with - linespacing=exact, lineheight=30. Do we - get significant separation between sentences?} -\end{Verbatim} -\medskip\noindent -The value of \texttt{lineheight}, which gives a `squeezing' effect between lines of the paragraph. - \end{description} - \end{description} -\end{description} - -\subsubsection{Miscellaneous markup for the \texorpdfstring{\protect\uif{Paragraph}}{Paragraph} classification} - -There are several other features that do not fit conveniently anywhere else, so here they are. - -\paragraph[Starting a new line using \texorpdfstring{\protect\cs{br}}{\textbackslash{br}}]% -{Starting a new line using \cs{br}.}\chgCurrLblName{Starting a new line using \protect\cs{br}}\label{para:NewLine} -The \cs{br} command expands to \texttt{
}. It should not be put within -the second argument of the \cs{span} command. As was the case with \cs{bf}, -\cs{it}, \cs{sub}, and \cs{sup}, do not directly code in \texttt{
} for -you will fail. -\begin{Verbatim}[xleftmargin=\amtIndent] -\rtpara{para1}{Let's begin a sentence,\br then we'll - start a new line for no apparent reason.\br\br - Let's double down on the new lines shall we?} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{Let's begin a sentence,\br then we'll - start a new line for no apparent reason.\br\br Let's - double down on the new lines shall we?} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp*6} -\end{quote} - -\paragraph[Adding spaces with \texorpdfstring{\cs{spc}}{\textbackslash{spc}}]{Adding - spaces with \cs{spc}.}\chgCurrLblName{Adding - spaces with \protect\cs{spc}}\label{para:addSPC} - As with {\TeX} multiple spaces are ignored. To insert additional - `hard' spaces into the data stream, use the \cs{spc} command. (This is a local command that - is undefined outside \cs{rtpara}. -\begin{Verbatim}[xleftmargin=\amtIndent] -\rtpara{para1}{Way to go!\spc\spc\spc\spc The Coach} -\end{Verbatim} -Here we induce four hard spaces. -\begin{quote} -\rtpara{para1}{Way to go!{\spc\spc\spc\spc}The Coach} -\incFldCnt\textField[\Ff{\FfRichText}%\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp} -\end{quote} - -\paragraph[Using the \texorpdfstring{\texttt{raw}}{raw} key]{Using -the \texttt{raw} key.}\chgCurrLblName{Using -the \texttt{raw} key}\label{para:RawKey} -There is another key, the \texttt{raw} key, that can be used -within the optional argument of \cs{rtpara} or within the first argument of \cs{span}. Using this key, -you can pass raw CSS2 markup. -\begin{Verbatim}[xleftmargin=\amtIndent] -\rtpara{para1}{We test the letter-spacing - attribute:\br\br\span{raw=letter-spacing:0.25em;} - {We test the letter-spacing attribute.}} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{We test the letter-spacing attribute:\br\br\span{raw=letter-spacing:0.25em;}{We test the letter-spacing -attribute.}} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3.5in}{16bp*6} -\end{quote} -The syntax for a CSS2 attribute is `\texttt{\ameta{key}:\ameta{value};}', that is, keys and values are separated -by a colon (\texttt{:}) and the value is terminated with a semi-colon (\texttt{;}). - -It appears that tab stops work as well, these can be specified using the \texttt{raw} key as well. Refer to the -XFA Specifications~\cite{webpage:XFASpec}. - -\paragraph[Special characters]{Special characters.}\chgCurrLblName{Special characters}\label{para:SpecChars} - The \pkg{richtext} handles special characters pretty well. -Before \cs{rtpara} reads its third argument (\ameta{rich-text-paragraph}), a -number of changes in \cs{catcode}s and redefinitions occur. Within -\cs{rtpara}, the following characters \emph{do not need to be} escaped: -\texttt{\$}, \texttt{\#}, and \texttt{\string~} (tilde). The following -characters \emph{need to be} escaped: \texttt{\cs{<}}, \texttt{\cs{>}}, -\verb|\&|, \verb|\%| (the comment character (\texttt{\%}) retains its -{\LaTeX} meaning), \verb|\{|, and \verb|\}| (the left and right braces have -their usual \TeX/LaTeX{} meaning). The single quote (\texttt{'}) and double quote (\texttt{"}) may -be optionally escaped (to \cs{'} and \cs{"}). Escape them if something goes wrong. Use the -command \cs{cs\darg{\ameta{text}}} to obtain a literal backslash (`\verb|\|'); for example -\verb|\cs{LaTeX}|, shown below, expands to `\texttt{\cs{LaTeX}}'. -\begin{Verbatim}[fontsize=\small] -\rtpara{para1}{We \"test\" \'special\' \bf{characters:} - \<\>\&\{ #\% in \cs{LaTeX} $x^2_4$ becomes - \it{x}\sup{2}\sub{4} \{\}} -\end{Verbatim} -The above \cs{rtpara} paragraph has two forms the \psf{RV} form and the \psf{V} form; these -can be seen by using the \cs{useRV} and \cs{useV} commands. - -\begingroup\raggedright -\makeatletter\def\rt@SC{;\penalty0}\makeatother -\rtpara{para1}{We \"test\" 'special' \bf{characters:} \<\>\&\{ #\% in -\cs{LaTeX} $x^2_4$ becomes \it{x}\sup{2}\sub{4} \{\}} -\begin{quote} -\hspace*{-\leftmargini}\textbf{\cs{useRV\darg{para1}:}} \texttt{\useRV{para1}} - -\hspace*{-\leftmargini}\textbf{\cs{useV\darg{para1}:}} \texttt{\useV{para1}} -\end{quote} -The resulting rich text form field is seen below:\\[3pt] -\makeatletter\def\rt@SC{;}\makeatother -\rtpara{para1}{We \"test\" \'special\' \bf{characters:} \<\>\&\{ #\% in -\cs{LaTeX} $x^2_4$ becomes \it{x}\sup{2}\sub{4} \{\}} -\incFldCnt\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp*4} -\par\endgroup -\medskip\noindent -That's pretty cool! - -\section{Rich text fields} - -Up to this point in the manual, the discussion has focused on creating rich -text strings. They may be fun to create and look at, but usually we want to -insert them into a text field. The comments here are for \pkg{eforms} -package, having checked with \pkg{hyperref} to see if there is a \psf{RV} -key, there is not. - -To create a rich text field, use the \cs{textField} command of \pkg{eforms}: -\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} - \DS{!ameta(defaultstyle)}\RV{!ameta(rich-value)}\V{!ameta(value)} -]{!ameta(fld-name)}{!ameta(width)}{!ameta(height)} -\end{Verbatim} -Remove \cs{Ff\darg{\cs{FfMultiline}}} if the field is only a single line. We -discuss the \psf{DS} key (\cs{DS}) key first, followed by the keys \psf{RV} -and \psf{V} (\cs{RV} and \cs{V}). - -\subsection{The \texorpdfstring{\protect\psf{DS}}{DS} key} - -The value of the \psf{DS} key sets the formatting for the text field as a -whole. Most importantly, use it to set the font, text size, and color. -There is a built-in default style, defined below: -\bVerb\takeMeasure{\small\string\newcommand\string\useDefaultDS\darg{font-family:Helvetica,sans-serif;}}% -\begin{dCmd}[fontsize=\small,commandchars=!()]{\bxSize} -\newcommand\useDefaultDS{font-family:Helvetica,sans-serif; - font-size:12.0pt;font-style:normal;font-weight:normal; - text-align:left;color:#000000} -\end{dCmd} -\eVerb You may redefine it to suit your purposes, but this is what -\app{Acrobat}/\app{Adobe Reader} sets as the default style. I would recommend -\cs{setDefaultStyle} to define your own custom default style. \cs{useDefaultDS} is the reason -why most all rich text fields in this document use Helvetica at \texttt{12pt}! Use -\cs{useDefaultDS} as follows, shown in bold font: -\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} - \DS{!textbf(\useDefaultDS)}\RV{!ameta(rich-value)}\V{!ameta(value)} -]{!ameta(fld-name)}{!ameta(width)}{!ameta(height)} -\end{Verbatim} - -\newtopic\noindent To create a custom default style use \cs{setDefaultStyle}. -\bVerb\takeMeasure{\string\setDefaultStyle\darg{\ameta{name}}\darg{\ameta{Font-Para-attrs}}}% -\begin{dCmd}[commandchars=!()]{\bxSize} -\setDefaultStyle{!ameta(name)}{!ameta(Font-Para-attrs)} -\useDS{!ameta(name)} -\end{dCmd} -Typically, the key-values associated with the \uif{Font} tab, Section~\ref{s:FLtabs}, may be used, -some key-values are removed, such as \texttt{ul}, \texttt{raise}, and \texttt{url}. When you've defined -a custom default style using \cs{setDefaultStyle}, insert \cs{useDS\darg{\ameta{name}}} as the value -of the \psf{DS} key.\incFldCnt -\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] -\rtpara{para1}{The font should be \'Myriad Pro\' at 10pt - and the default color of the field is webbrown, a color - defined in the web package.} -\setDefaultStyle{myStyle}{font='Myriad Pro',size=10, - color=!htmlWebBrown} -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} - \DS{!textbf(\useDS{myStyle})}\RV{\useRV{para1}}\V{\useV{para1}} -]{rtFld!the!fldCnt}{3in}{16bp*3} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{The font should be \'Myriad Pro\' at 10pt and the - default color of the field is webbrown, a color defined in the web package.} -\setDefaultStyle{myStyle}{font='Myriad Pro',size=10,color=\htmlWebBrown} -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDS{myStyle}}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp*3} -\end{quote} -Note the use of \cs{useRV} and \cs{useV} in the \psf{RV} and \psf{V} fields. -These are discussed in the next section. - -\subsection{The \texorpdfstring{\protect\psf{RV}}{RV} and -\texorpdfstring{\protect\psf{V}}{V} keys} - -The techniques to handle multiple paragraph fields are more complex (but not discouragingly so), -that topic will be taken up after the discussion of single paragraph fields. - -\subsubsection{Single paragraph fields} - -For a single paragraph field, there is only one \cs{repara} defined prior to the field. This string -data (both rich and plain) are inserted into the \cs{RV} and \cs{V} keys using \cs{useRV} and \cs{useV}. We repeat the -previous example, but with the emphasis on \cs{RV} and \cs{V}, and not on \cs{DS}. -\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] -\rtpara{para1}{The font should be \'Myriad Pro\' at 10pt - and the default color of the field is webbrown, a - color defined in the web package.} -\setDefaultStyle{myStyle}{font='Myriad Pro',size=10, - color=!htmlWebBrown} -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} - \DS{\useDS{myStyle}}\RV{!textbf(\useRV{para1})}\V{!textbf(\useV{para1})} -]{rtFld!the!fldCnt}{3in}{16bp*3} -\end{Verbatim} -\begin{quote} -\rtpara{para1}{The font should be \'Myriad Pro\' at 10pt and the -default color of the field is webbrown, a color defined in the web package.} -\setDefaultStyle{myStyle}{font='Myriad Pro',size=10,color=\htmlWebBrown} -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDS{myStyle}}\RV{\useRV{para1}}\V{\useV{para1}}]{rtFld\the\fldCnt}{3in}{16bp*3} -\end{quote} -We declare our rich paragraph string using \cs{rtpara} and name it -\texttt{para1}. We insert two data streams, one into the rich text key -(\cs{RV\darg{useRV\darg{para}}}) and the other into the (plain) text key -(\cs{V\darg{useV\darg{para}}}). - - -\subsubsection{Multiple paragraph fields} - -The strategy is to use several \cs{rtpara} commands to declare several rich -text paragraph. What is the best way to `paste' these paragraphs together? The method -developed is to use \cs{setRVVContent} command. -\bVerb\takeMeasure{\string\setRVVContent\darg{\ameta{name}}\darg{ \darg{\ameta{name\SUB{1}}}\darg{\ameta{name\SUB{2}}}...\darg{\ameta{name\SUB{k}}} }}% -\begin{dCmd}[commandchars=!()]{\bxSize} -\setRVVContent{!ameta(name)}{ {!ameta(name!SUB(1))}{!ameta(name!SUB(2))}...{!ameta(name!SUB(k))} } -\end{dCmd} -\eVerb where \ameta{name\SUB{i}} is the name of a rich text paragraph string, -or is the keyword \texttt{skipline}. The keyword \texttt{skipline} is -case-sensitive, it must be typed exactly. The role \texttt{skipline} plays is to -insert a blank line between paragraphs; \texttt{\darg{skipline}} inserts one -blank line between paragraphs. - -Having composed how the strings are to be put together, we need to insert them into -\psf{RV} and \psf{V}. -\bVerb\takeMeasure{\string\useRVContent\darg{\ameta{name}}}% -\begin{dCmd}[commandchars=!()]{\bxSize} -\useRVContent{!ameta(name)} -\useVContent{!ameta(name)} -\end{dCmd} -\eVerb where \ameta{name} is the name given in a previous \cs{setRVVContent} -command. Insert \cs{useRVContent} as the value of the \psf{RV} key, and -\cs{useVContent} as the value of the \psf{V} key. - -We take as an example, the one from Section~\ref{s:CreateRTS}.\incFldCnt -\begin{Verbatim}[fontsize=\small] -\rtpara[indent=first]{para1}{Now is the time for - \span{style={bold,italic,strikeit},color=ff0000}{J\374rgen} - and all good men to come to the aid of \it{their} - \bf{country}. Now is the time for \span{style=italic} - {all good} women to do the same.} -\rtpara[indent=first]{para2}{With rich text, we can format the - text within the text field. As a reader of this rich text - field, you can edit the contents of the box, feel free to - do so.} -\rtpara[halign=right]{para3}{D. P. Story - \span{url=http://www.acrotex.net}{AcroTeX.Net}} -\end{Verbatim} -Now set the content with \cs{setRVVContent}, naming it \texttt{myContent}. -\begin{Verbatim}[fontsize=\small] -\setRVVContent{myContent}{{para1}{para2}{skipline}{para3}} -\end{Verbatim} -Having done all that, we create our rich text field: -\begin{Verbatim}[fontsize=\small,commandchars=!()] -\begin{center} -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} - \DS{\useDefaultDS} - !textbf(\RV{\useRVContent{myContent}}) - !textbf(\V{\useVContent{myContent}}) -]{rtFld!the!fldCnt}{4in}{10\baselineskip} -\end{center} -\end{Verbatim} -where, the \cs{RV} and \cs{V} keys are highlighted in bold for your viewing pleasure. -The rich text field the result of these declarations. - -\rtpara[indent=first]{para1}{Now is the time for -\span{style={bold,italic,strikeit},color=ff0000}{J\374rgen} and -all good men to come to the aid of \it{their} \bf{country}. Now -is the time for \span{style=italic}{all good} women to do the same.} -\rtpara[indent=first]{para2}{With rich text, we can format the text within -the text field. As a reader of this rich text field, you can edit the -contents of the box, feel free to do so.} -\rtpara[halign=right]{para3}{D. P. Story \span{url=http://www.acrotex.net}{AcroTeX.Net}} - -\setRVVContent{myContent}{{para1}{para2}{skipline}{para3}} - -\begin{center} -%\previewtrue -\incFldCnt -\textField[\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS}%\DS{\useDS{myDS}}% -\RV{\useRVContent{myContent}}\V{\useVContent{myContent}}]{rtFld\the\fldCnt}{4in}{10\baselineskip} -\end{center} - -The argument of \cs{setRVVContent} is pretty robust. In making our declarations, we can type: -\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] -\setRVVContent{myContent} -{ - {para1} - {para2} - {skipline} - {skipline} - {para3} -} -\end{Verbatim} -Note that I've added a \texttt{skipline} so that are two blank lines after the second paragraph -and before the third paragraph. - -\bigskip\noindent -That's about it! Now, back to my retirement. \dps \space (See next page) - -\newpage - -Did I say that you can write captions to figures using rich text? - -\rtpara[valign=bottom,margbottom=12,margleft=12,margright=12]{farewell}{\bf{Thank you} for reviewing the -\span{font=Courier}{richtext} package, I hope you will enjoy exploring -it. Did I say that \span{url=www.acrotex.net,style=bold}{AcroTeX Rocks!}\spc\spc\spc\spc dps} - -\begin{center}\incFldCnt -\makebox[\dpswebW]{\makebox[0pt][l]{\textField[\BC{}\BG{}\autoCenter{n}\Ff{\FfRichText}\Ff{\FfMultiline} -\DS{\useDefaultDS} -\RV{\useRV{farewell}}\V{\useV{farewell}}]{rtFld\the\fldCnt}{\dpswebW}{\dpswebH}}% - \includegraphics{dpsweb}} -\end{center} - -\newpage - -\begin{thebibliography}{[1]}\label{references} -\addcontentsline{toc}{section}{\protect\numberline{}References} -%\backrefparscanfalse -\let\backrefprint\relax -\def\srtln{\vskip-\baselineskip\vskip-\parsep} -\def\lngln{\vskip-\parsep} - -\bibitem{webpage:XFASpec}\hypertarget{references}{}% -Adobe XML Forms Architecture (XFA) Specification, Version 3.3, Adobe Systems, Inc., -Jan.\ 2012\backrefprint - \lngln\hfill{\small\url{partners.adobe.com/public/developer/xml/index_arch.html}} - -\bibitem{webpage:CSS2} -Cascading Style Sheets (CSS 2.2) Specification, Editors: Bert Bos \textsl{et al.}, -World Wide Web Consortium (W3C), June 2011 - \lngln\hfill{\small\url{https://www.w3.org/TR/CSS2/}} - -\bibitem{tech:AcroJS} - JavaScript for Acrobat API Reference, - Adobe Systems, Inc., May 2015 - \lngln\hfill{\small\url{adobe.com/devnet/acrobat/documentation.html}} - -\bibitem{book:pdfspec} - PDF Reference, Sixth Edition, Version 1.7, Adobe Systems, Inc., 2006 - \lngln\hfill{\small\url{adobe.com/devnet/pdf/pdf_reference_archive.html}} - - -\end{thebibliography} - - - -% Adobe XML Forms Architecture (XFA) Specification, version 3.3, Jan. 2012, -% http://partners.adobe.com/public/developer/xml/index_arch.html - -\end{document} - -\bVerb\takeMeasure{\string\useNoHints\quad\string\useHints}% -\begin{dCmd}[commandchars=!()]{\bxSize} -\useNoHints!quad\useHints -\end{dCmd} -\eVerb The commands are used between \env{card} environments to change the -default usage of hints. When hints are \emph{not provided}, a simple message -defined by the command \cs{noHintProvided} (see \autopageref{noHintProvided}) appears on the hint page. diff --git a/texmf-dist/source/latex/richtext/richtext.dtx b/texmf-dist/source/latex/richtext/richtext.dtx index 51bb4118..c56bd39d 100644 --- a/texmf-dist/source/latex/richtext/richtext.dtx +++ b/texmf-dist/source/latex/richtext/richtext.dtx @@ -2,7 +2,7 @@ %<*copyright> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% richtext package, %% -%% Copyright (C) 2016 D. P. Story %% +%% Copyright (C) 2016--2020 %% %% dpstory@uakron.edu %% %% %% %% This program can redistributed and/or modified under %% @@ -14,24 +14,33 @@ % %\NeedsTeXFormat{LaTeX2e}[1997/12/01] %\ProvidesPackage{richtext} -% [2016/10/03 v1.0c richtext: create rich text strings (dps)] +% [2020/07/02 v1.1.1 richtext: create rich text strings (dps)] %<*driver> \documentclass{ltxdoc} \usepackage[colorlinks,hyperindex=false]{hyperref} \usepackage{calc} +\usepackage{fancyvrb} \let\uif\textsf\let\app\textsf \let\pkg\textsf\let\env\texttt \def\psf#1{\textsf{\textbf{#1}}} +\bgroup\ttfamily \gdef\brpr#1{\char123\relax#1\char125\relax}\egroup +\let\darg\brpr +\let\env\texttt +\let\opt\texttt +\let\app\textsf +\def\visispace{\symbol{32}} +\def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}} +\def\meta#1{\textsl{\texttt{#1}}} +\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}} +\def\ltag{<}\def\rtag{>} +\let\app\textsf\let\pkg\textsf\def\CMD#1{\textbackslash#1} %\pdfstringdefDisableCommands{\let\\\textbackslash} -\OnlyDescription % comment out for implementation details -\EnableCrossrefs -\CodelineIndex -\RecordChanges +%\OnlyDescription % comment out for implementation details +\EnableCrossrefs \CodelineIndex \RecordChanges \InputIfFileExists{aebdocfmt.def}{\PackageInfo{richtext}{Inputting aebdocfmt.def}} {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax \PackageInfo{richtext}{aebdocfmt.def cannot be found}} \begin{document} -\def\CMD#1{\textbackslash#1} \GetFileInfo{richtext.sty} \title{\textsf{richtext}: Creating Rich Text Strings} \author{D. P. Story\\ @@ -40,10 +49,6 @@ \maketitle \tableofcontents \let\Email\texttt - \renewenvironment{theglossary}{% - \let\efill\relax - \begin{itemize}}{\end{itemize}} - \value{GlossaryColumns}=1 \DocInput{richtext.dtx} \IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here.\\Execute \texttt{makeindex -s gind.ist -o richtext.ind richtext.idx} on the command line and recompile @@ -55,12 +60,16 @@ % % \fi % \MakeShortVerb{|} -% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{web}{Inputting aebdonotindex.def}} -% {\PackageInfo{web}{cannot find aebdonotindex.def}} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{richtext}{Inputting aebdonotindex.def}} +% {\PackageInfo{richtext}{cannot find aebdonotindex.def}} % \begin{macrocode} %<*package> -\RequirePackage{xkeyval} -\RequirePackage{ifxetex}[2006/08/21] +\RequirePackage{xkeyval} +\RequirePackage{ifpdf} +\RequirePackage{ifxetex}[2006/08/21] +\RequirePackage{eforms} +\@ifundefined{ifpdfmarkup}{\newif\ifpdfmarkup}{}\pdfmarkupfalse +\ifpdf\else\ifxetex\else\pdfmarkuptrue\fi\fi % \end{macrocode} % \section{Introduction} % This package supports the creation of \emph{rich text strings} (a type of pdf string). A @@ -73,31 +82,34 @@ % restricted set of CSS2 style attributes.'' % % A rich text field may be created using the \pkg{eforms} package, like so -%\begin{verbatim} -% \textField[\Ff{\FfRichText}\Ff{\FfMultiline} -% \DS{}\RV{}\V{} -% ]{}{}{} -%\end{verbatim} +%\begin{Verbatim}[xleftmargin=\parindent,codes={\catcode`\%=9},commandchars={!()}] +%\textField[\Ff{\FfRichText}\Ff{\FfMultiline}!ameta(other-options) +%!quad\DS{!ameta(defaultstyle)}\RV{!ameta(rich-value)}\V{!ameta(plain-value)} +%]{!ameta(fldname)}{!ameta(width)}{!ameta(height)} +%\end{Verbatim} % This package provides commands and methods for `conveniently' create values -% \texttt{} and \texttt{} for \psf{RV} and -% \psf{DS}; additionally, the value \texttt{} of the \psf{V} key is the `plain' text +% \ameta{rich-value} and \ameta{defaultstyle} for \psf{RV} and +% \psf{DS}; additionally, the value \ameta{plain-value} of the \psf{V} key is the `plain' text % value of the field; that is the text with all the formatting stripped out. +% \changes{v1.1.1}{2020/07/02}{Did not upload the docs, retry under new version number.} % %\section{Preliminaries} % \begin{macrocode} \newif\ifrt@formfield \rt@formfieldtrue \newif\ifrt@needsbody\rt@needsbodyfalse \@ifpackageloaded{eforms}% - {\ifxetex\let\@eqV\@eqnuV\fi}{\rt@needsbodytrue} + {\ifxetex\let\@eqV\@eqnuV\fi}{\rt@needsbodytrue} +\ifxetex\else\hypersetup{pdfencoding=pdfdoc}\fi \providecommand\eq@RV@Body{} + xfa:APIVersion="Acroform:2.7.0.0" % + xfa:contentType="text/html" % + xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" % + xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">} \providecommand\eq@RV@endBody{} \def\rt@bBody{\ifrt@needsbody\eq@RV@Body\fi} \def\rt@eBody{\ifrt@needsbody\eq@RV@endBody\fi} % \end{macrocode} +% %\section{Documentation for the \texorpdfstring{\protect\psf{RV}}{RV} key} % %We follow the \app{Acrobat} user interface. @@ -156,39 +168,39 @@ % in single quotes: \texttt{font=Arial} or \texttt{font='Myriad Pro'}. % \begin{macrocode} \define@key{rtFont}{font}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty - \let\rf@font\@empty\else\rtfontstyletrue - \def\rf@font{font-family:#1}\fi} + \let\rf@font\@empty\else\rtfontstyletrue + \def\rf@font{font-family:#1}\fi} % \end{macrocode} % The value of \IndexKey{size}\texttt{size} is the size of the font, as measured in points % \texttt{font=12pt}, note the use of the entity `\texttt{pt}'. % \begin{macrocode} \define@key{rtFont}{size}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty - \let\rf@size\@empty\else\rtfontstyletrue\def\rf@size@num{#1}% - \def\rf@size@pt{#1pt}\def\rf@size{font-size:#1pt}\fi} + \let\rf@size\@empty\else\rtfontstyletrue\def\rf@size@num{#1}% + \def\rf@size@pt{#1pt}\def\rf@size{font-size:#1pt}\fi} \def\rf@size@num{12}\def\rf@size@pt{12pt} % \end{macrocode} -% The key \IndexOpt{raise}\texttt{raise} corresponds to the user interface item \uif{Baseline Shift}, +% The key \IndexKey{raise}\texttt{raise} corresponds to the user interface item \uif{Baseline Shift}, % measured in points, for example, \texttt{raise=6pt}. % \begin{macrocode} \define@key{rtFont}{raise}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty - \let\rf@raise\@empty\else\rtfontstyletrue - \def\rf@raise{vertical-align:#1pt}\fi} + \let\rf@raise\@empty\else\rtfontstyletrue + \def\rf@raise{vertical-align:#1pt}\fi} % \end{macrocode} -% The key \IndexOpt{ulstyle}\texttt{ulstyle} supplies an underline attribute, for example, +% The key \IndexKey{ulstyle}\texttt{ulstyle} supplies an underline attribute, for example, % \texttt{ul=word} underlines each word in the span. % \begin{macrocode} \define@choicekey+{rtFont}{ulstyle}[\val\nr]% - {none,ul,2ul,wul,2wul}[none]{% - \ifcase\nr\relax - \def\rf@ul{none}\or - \def\rf@ul{underline}\or - \def\rf@ul{double}\or - \def\rf@ul{word}\or - \def\rf@ul{double word}\fi - \rtfontstyletrue + {none,ul,2ul,wul,2wul}[none]{% + \ifcase\nr\relax + \def\rf@ul{none}\or + \def\rf@ul{underline}\or + \def\rf@ul{double}\or + \def\rf@ul{word}\or + \def\rf@ul{double word}\fi + \rtfontstyletrue }{} % \end{macrocode} -% The key \IndexOpt{color}\texttt{color} supplies a color attribute for the text in the span. +% The key \IndexKey{color}\texttt{color} supplies a color attribute for the text in the span. % There are two formats: \texttt{rrggbb} (hex) and \texttt{rgb(r,g,b)} (0-255). For example, % \texttt{color=ff0000} or \texttt{color=rgb(255,0,0)} both color the text red. % \begin{macrocode} @@ -199,57 +211,57 @@ \bgroup\@makeother\#\@makeother\&% \gdef\rt@hashtag{#}\gdef\rt@amp{&}\egroup \define@key{rtFont}{color}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty - \let\rf@color\@empty\else\rtfontstyletrue - \rt@parseColor#1(\@nil - \if\rt@rgbdec\rt@One - \def\rf@color{color:#1}\else - \def\rf@color{color:\rt@hashtag#1}\fi + \let\rf@color\@empty\else\rtfontstyletrue + \rt@parseColor#1(\@nil + \if\rt@rgbdec\rt@One + \def\rf@color{color:#1}\else + \def\rf@color{color:\rt@hashtag#1}\fi \fi} \let\rf@color\@empty % \end{macrocode} -% The key \IndexOpt{url}\texttt{url} enable the rich text string to contain +% The key \IndexKey{url}\texttt{url} enable the rich text string to contain % a URL hypertext link. % \begin{macrocode} \define@key{rtFont}{url}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty - \let\rt@url\@empty\else\rtfontstyletrue\def\rt@url{#1}\fi} + \let\rt@url\@empty\else\rtfontstyletrue\def\rt@url{#1}\fi} % \end{macrocode} -% The \texttt{rtFontStyle} family provides keys \IndexOpt{bold}\texttt{bold}, -% \IndexOpt{italic}\texttt{italic} and \IndexOpt{strikeit}\texttt{strikeit}. +% The \texttt{rtFontStyle} family provides keys \IndexKey{bold}\texttt{bold}, +% \IndexKey{italic}\texttt{italic} and \IndexKey{strikeit}\texttt{strikeit}. % They are possible values of the \texttt{style} key, define below. The \texttt{style} key % can take on one or several values. % \begin{macrocode} \define@choicekey+{rtFontStyle}{bold}[\val\nr]{normal,bold}[bold]% - {\edef\rfS@bold{\val}}{} + {\edef\rfS@bold{\val}}{} \define@choicekey+{rtFontStyle}{italic}[\val\nr]{normal,italic}[italic]% - {\edef\rfS@italic{\val}}{} + {\edef\rfS@italic{\val}}{} \define@key{rtFontStyle}{strikeit}[]{\def\rfS@strikeit{line-through}} \let\rfS@normal\@empty\let\rfS@bold\@empty \let\rfS@italic\@empty\let\rfS@strikeit\@empty % \end{macrocode} -% Continuing the \texttt{rtFont} family, the \IndexOpt{style}\texttt{style} can take on +% Continuing the \texttt{rtFont} family, the \IndexKey{style}\texttt{style} can take on % several values: The key-value of \texttt{style=\{bold,italic,strikeit\}} sets the text to bold, italic, % and strike out. Multiple attributes must be enclosed in parentheses, as shown above. % \begin{macrocode} \define@key{rtFont}{style}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty - \let\rf@style\@empty\else\rtfontstyletrue\def\rf@style{#1}\fi} + \let\rf@style\@empty\else\rtfontstyletrue\def\rf@style{#1}\fi} % \end{macrocode} % We provide a \IndexKey{raw}\texttt{raw} experimental key. The value of this key is passed through; it must % be of the proper syntax. % \begin{macrocode} \define@key{rtFont}{raw}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty - \let\rf@raw\@empty\else\rtfontstyletrue\def\rf@raw{#1}\fi} + \let\rf@raw\@empty\else\rtfontstyletrue\def\rf@raw{#1}\fi} % \end{macrocode} % The \DescribeMacro{\resetRtFontKeys} is an internal command to reset all keys to their default values. % \begin{macrocode} \def\resetRtFontKeys{% rtFont family - \let\rf@font\@empty\let\rf@size\@empty - \let\rf@raise\@empty\let\rf@ul\@empty - \let\rf@color\@empty\let\rf@style\@empty\let\rt@url\@empty - \let\rf@raw\@empty - % rtFontStyle family - \let\rfS@normal\@empty\let\rfS@bold\@empty - \let\rfS@italic\@empty\let\rfS@strikeit\@empty - \rtfontstylefalse} + \let\rf@font\@empty\let\rf@size\@empty + \let\rf@raise\@empty\let\rf@ul\@empty + \let\rf@color\@empty\let\rf@style\@empty\let\rt@url\@empty + \let\rf@raw\@empty +% rtFontStyle family + \let\rfS@normal\@empty\let\rfS@bold\@empty + \let\rfS@italic\@empty\let\rfS@strikeit\@empty + \rtfontstylefalse} % \end{macrocode} % Now give all keys their default values. % \begin{macrocode} @@ -284,10 +296,10 @@ % \begin{macrocode} \newif\if@rvstring \@rvstringfalse \def\rvorvstring{\if@rvstring - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi } % \end{macrocode} % \paragraph*{Subscripts (\cs{sub}\DescribeMacro{\sub}) and superscripts (\cs{sup}\DescribeMacro{\sup})} There are two versions, one for rich text expansion @@ -303,7 +315,7 @@ \def\rt@bf#1{\rvorvstring{#1}{#1}} \def\rt@it#1{\rvorvstring{#1}{#1}} \def\rt@spc{\rvorvstring{\rt@amp - \rt@hashtag160\rt@SC}{ }} + \rt@hashtag160\rt@SC}{ }} % \end{macrocode} % Some convenience commands % \begin{macrocode} @@ -314,47 +326,46 @@ % are \cs{rt@remove@span} for plain text and \cs{rt@span} for rich text strings. % \begin{macrocode} \def\rt@remove@span#1#2{#2} -%\let\rt@remove@span\@gobble % \end{macrocode} % \begin{macro}{\rt@span} % This is the internal \cs{span} command, it is \cs{let}\cs{span}\cs{rt@span}. Of course % \cs{span} is a {\TeX} primitive, so we must be careful not to overwrite it. % \begin{macrocode} \def\rt@StyleAttr{\ifx\rf@font\@empty\else\rf@font\rt@SC\fi - \ifx\rf@size\@empty\else\rf@size\rt@SC\fi - \ifrt@formfield\ifx\rf@raise\@empty\else\rf@raise\rt@SC\fi\fi - \ifx\rf@ul\@empty\ifx\rfS@strikeit\@empty\else - \rt@td\rt@CN\rfS@strikeit\rt@SC\fi - \else\rt@td\rt@CN\rf@ul\ifx\rfS@strikeit\@empty\else\space - \rfS@strikeit\fi\rt@SC\fi - \ifx\rfS@bold\@empty\else\rt@fw\rt@CN\rfS@bold\rt@SC\fi - \ifx\rfS@italic\@empty\else\rt@fs\rt@CN\rfS@italic\rt@SC\fi - \ifx\rf@color\@empty\else\rf@color\rt@SC\fi - \ifx\rf@raw\@empty\else\rf@raw\fi} + \ifx\rf@size\@empty\else\rf@size\rt@SC\fi + \ifrt@formfield\ifx\rf@raise\@empty\else\rf@raise\rt@SC\fi\fi + \ifx\rf@ul\@empty\ifx\rfS@strikeit\@empty\else + \rt@td\rt@CN\rfS@strikeit\rt@SC\fi + \else\rt@td\rt@CN\rf@ul\ifx\rfS@strikeit\@empty\else\space + \rfS@strikeit\fi\rt@SC\fi + \ifx\rfS@bold\@empty\else\rt@fw\rt@CN\rfS@bold\rt@SC\fi + \ifx\rfS@italic\@empty\else\rt@fs\rt@CN\rfS@italic\rt@SC\fi + \ifx\rf@color\@empty\else\rf@color\rt@SC\fi + \ifx\rf@raw\@empty\else\rf@raw\fi} % \end{macrocode} % The \DescribeMacro{\span}\cs{span} is let to \cs{rt@span} within the \cs{rtpara} command. % \changes{v1.0c}{2016/10/03}{Added \string\cs{rt@afterFont} to allow access by \string\pkg{annot\_pro}.} % \begin{macrocode} \let\rt@afterFont\relax \newcommand\rt@span[2]{\resetRtFontKeys - \edef\x{\noexpand\setkeys{rtFont}{#1}}\x\rt@afterFont - \edef\x{\noexpand\setkeys{rtFontStyle}{\rf@style}}\x - \edef\rt@Style@ttr{\rt@StyleAttr}% - \ifx\rt@url\@empty + \edef\x{\noexpand\setkeys{rtFont}{#1}}\x\rt@afterFont + \edef\x{\noexpand\setkeys{rtFontStyle}{\rf@style}}\x + \edef\rt@Style@ttr{\rt@StyleAttr}% + \ifx\rt@url\@empty % \end{macrocode} % We are processing a regular \cs{span}. % \begin{macrocode} - \ifx\rt@StyleAttr\@empty\def\x{#2}\else - \edef\x{#2}\fi - \else + \ifx\rt@StyleAttr\@empty\def\x{#2}\else + \edef\x{#2}\fi + \else % \end{macrocode} % We are processing a \cs{span} with the \texttt{url} key set. % \begin{macrocode} - \ifx\rt@StyleAttr\@empty\edef\x{#2}\else - \edef\x{#2\fi}\fi - \fi + \ifx\rt@StyleAttr\@empty\edef\x{#2}\else + \edef\x{#2\fi}\fi + \fi } % \end{macrocode} % \end{macro} @@ -365,7 +376,7 @@ % This is how you define a rich text string, through the use of \cs{rtpara}. The command % takes three options: (1) The optional first takes key-values just defined in the \texttt{rtFont} % and the \texttt{rtPara} families. -%\begin{verbatim} +%\begin{Verbatim}[xleftmargin=\parindent,codes={\catcode`\%=9},commandchars={!()}] % halign: text-align:left|center|right|justify % valign: text-valign:top|middle|bottom % top is same as no text-valign attribute (vertical-align) @@ -383,19 +394,19 @@ % 1.5 Lines : line-height: 1.8*max(\rt@size) % Double : line-height: 2.4*max(\rt@size) % Exact : line-height: pt -%\end{verbatim} +%\end{Verbatim} %\paragraph*{Alignment} % The \IndexKey{halign}\texttt{halign} key effects the horizontal alignment of a paragraph, choices % are \texttt{left}, \texttt{center}, \texttt{right}, and \texttt{justify}. The default is \texttt{left}. % \begin{macrocode} \define@choicekey+{rtPara}{halign}[\val\nr]% - {left,center,right,justify}[left]{% - \ifcase\nr\relax - \def\rt@halign{text-align:left}\or - \def\rt@halign{text-align:center}\or - \def\rt@halign{text-align:right}\or - \def\rt@halign{text-align:justify}\fi - \rtfontstyletrue + {left,center,right,justify}[left]{% + \ifcase\nr\relax + \def\rt@halign{text-align:left}\or + \def\rt@halign{text-align:center}\or + \def\rt@halign{text-align:right}\or + \def\rt@halign{text-align:justify}\fi + \rtfontstyletrue }{} % \end{macrocode} % The \IndexKey{valign}\texttt{valign} seems to effect all paragraphs in the rich text field. Its value @@ -403,11 +414,11 @@ % The default is \texttt{top}. % \begin{macrocode} \define@choicekey+{rtPara}{valign}[\val\nr]{top,middle,bottom}[top]{% - \ifcase\nr\relax - \def\rt@valign{text-valign:top}\or - \def\rt@valign{text-valign:middle}\or - \def\rt@valign{text-valign:bottom}\fi - \rtfontstyletrue + \ifcase\nr\relax + \def\rt@valign{text-valign:top}\or + \def\rt@valign{text-valign:middle}\or + \def\rt@valign{text-valign:bottom}\fi + \rtfontstyletrue }{} \let\rt@halign\@empty\let\rt@valign\@empty % \end{macrocode} @@ -442,15 +453,15 @@ % \texttt{oneandhalf} (spacing), \texttt{double} (spacing), and \texttt{exact} (spacing). % \begin{macrocode} \define@choicekey{rtPara}{linespacing}[\val\nr]% - {single,oneandhalf,double,exact}[single]{%line-height - \edef\rt@linespacingtype{\nr}% - \ifcase\nr - \let\rt@linesp\@empty\or - \setlength{\@tempdima}{1.8pt*\rf@size@num}% - \edef\rt@linesp{\the\@tempdima}\or - \setlength{\@tempdima}{2.4pt*\rf@size@num}% - \edef\rt@linesp{\the\@tempdima}\or - \def\rt@linesp{\rf@size@pt}\fi + {single,oneandhalf,double,exact}[single]{%line-height + \edef\rt@linespacingtype{\nr}% + \ifcase\nr + \let\rt@linesp\@empty\or + \setlength{\@tempdima}{1.8pt*\rf@size@num}% + \edef\rt@linesp{\the\@tempdima}\or + \setlength{\@tempdima}{2.4pt*\rf@size@num}% + \edef\rt@linesp{\the\@tempdima}\or + \def\rt@linesp{\rf@size@pt}\fi }{} \let\rt@linesp\@empty\def\rt@linespacingtype{0} % \end{macrocode} @@ -468,34 +479,31 @@ % \begin{macrocode} \def\rt@ParaAttr{% % Alignment - \ifx\rt@halign\@empty\else\rt@halign\rt@SC\fi + \ifx\rt@halign\@empty\else\rt@halign\rt@SC\fi \ifrt@formfield - \ifx\rt@valign\@empty\else\rt@valign\rt@SC\fi + \ifx\rt@valign\@empty\else\rt@valign\rt@SC\fi % Indents - \ifx\rt@margleft\@empty\else\rt@margleft\rt@SC\fi - \ifx\rt@margright\@empty\else\rt@margright\rt@SC\fi - \ifcase\rt@indenttype\space\or - \rtp@ti\rt@CN\rt@indentby\rt@SC\or - \rtp@ti\rt@CN-\rt@indentby\rt@SC\fi + \ifx\rt@margleft\@empty\else\rt@margleft\rt@SC\fi + \ifx\rt@margright\@empty\else\rt@margright\rt@SC\fi + \ifcase\rt@indenttype\space\or + \rtp@ti\rt@CN\rt@indentby\rt@SC\or + \rtp@ti\rt@CN-\rt@indentby\rt@SC\fi % Spacing - \rtp@mt\rt@CN\rt@margtop\rt@SC\rtp@mb\rt@CN\rt@margbottom\rt@SC - \ifx\rt@linesp\@empty\else - \if\rt@linespacingtype3% - \ifx\rt@lineheight\@empty - \rtp@lh\rt@CN\rt@linesp\rt@SC - \else - \rtp@lh\rt@CN\rt@lineheight\rt@SC - \fi - \else - \rtp@lh\rt@CN\rt@linesp\rt@SC - \fi + \rtp@mt\rt@CN\rt@margtop\rt@SC\rtp@mb\rt@CN\rt@margbottom\rt@SC + \ifx\rt@linesp\@empty\else + \if\rt@linespacingtype3% + \ifx\rt@lineheight\@empty + \rtp@lh\rt@CN\rt@linesp\rt@SC + \else + \rtp@lh\rt@CN\rt@lineheight\rt@SC + \fi + \else + \rtp@lh\rt@CN\rt@linesp\rt@SC \fi -\fi -} + \fi +\fi } \begingroup -\catcode`\@=0 @catcode`@\=12 -@gdef@rtbs{\} -@endgroup +\catcode`\@=0 @catcode`@\=12 @gdef@rtbs{\} @endgroup \def\rt@cs#1{\rvorvstring{\rtbs\rtbs#1}{\string\134#1}} % \end{macrocode} % The \DescribeMacro{\rtpara}\cmd{rtpara} takes three arguments. The first optional argument is key-value pairs @@ -510,90 +518,131 @@ % \begin{macrocode} \def\rt@dir{ dir="ltr"} % \end{macrocode} +% We still have problems with \app{dvips} wrapping postscript lines around that break +% the code. Here we remove all \cs{spaces}'s with PDF spaces (\cs{040}), hopefully, +% there are no spaces at which to break the line and cause harm. \cs{pdfSP} and +% \cs{dl@sp@ce} are defined in \pkg{insdljs}. +% \changes{v1.1}{2020/06/28}{For pdfmarkup, spaces are now obeyed, and replaced with \string\cs{040}} +% \begin{macrocode} +\def\rt@sp@ce{ } +\def\rtpdfSPDef{\string\040} +\def\rtpdfSPDefPrnt{\string\040\allowbreak} +\bgroup\obeyspaces +\gdef\makePDFSp{\global\let =\pdfSP}% +\gdef\makeTeXSp{\global\let =\rt@sp@ce}% +\gdef\makeTeXSpPrnt{\global\let =\rtpdfSPDefPrnt}% +\egroup +% \end{macrocode} +% Again, there are problems with EOL that disrupts \uif{RV} key. +% Here, we define \cs{insertPDFSp@tEOL} to insert a PDF space (\cs{040}) +% at the end of the line. Seems to work. +% \begin{macrocode} +\bgroup\catcode`\^^M=\active% +\gdef\insertPDFSp@tEOL{% + \catcode`\^^M=\active% + \let^^M\rtpdfSPDef% + \endlinechar=`\^^M}% +\egroup +% \end{macrocode} % \begin{macrocode} \newcommand\rtpara[2][]{\begingroup - \setkeys{rtPara,rtFont}{#1}\rt@afterParaFont - \edef\rt@Para@ttr{\rt@ParaAttr\rt@StyleAttr}% - \global\let\rt@RichText\@empty - \global\let\rt@PlainText\@empty - \def\rt@ctrlName{#2}% + \setkeys{rtPara,rtFont}{#1}\rt@afterParaFont + \edef\rt@Para@ttr{\rt@ParaAttr\rt@StyleAttr}% + \global\let\rt@RichText\@empty + \global\let\rt@PlainText\@empty + \def\rt@ctrlName{#2}% % \end{macrocode} % Before taking the next parameter, we'll make some special definitions. % \begin{macrocode} - \def\{{\string\{}\def\}{\string\}}% - \def\1{\string\1}\def\2{\string\2}\def\3{\string\3}% - \@makeother\$\@makeother\#\@makeother\^\@makeother\_\@makeother\~% - \@makeother\&\def\&{\rvorvstring{\string&}{\string&}}% req - \@makeother\<\def\<{\rvorvstring{\string<}{\string<}}% req - \@makeother\>\def\>{\rvorvstring{\string>}{\string>}}% - \@makeother\'\def\'{\rvorvstring{\string'}{\string'}}% - \@makeother\"\def\"{\rvorvstring{\string"}{\string"}}% - \let\cs\rt@cs - \rtpara@cont} -% \end{macrocode} -% \cs{rtpara} continues with \cs{rtpara@cont}. -% \begin{macrocode} -\def\rtpara@cont#1{% - \let\sup\rt@sup\let\sub\rt@sub - \let\br\rt@br\let\bf\rt@bf\let\it\rt@it - \let\spc\rt@spc - \let\span\rt@remove@span - \@rvstringfalse - \edef\x{#1}\expandafter\@AddToPlainText\expandafter{\x}% - \let\span\relax - \@rvstringtrue - \rtpara@i#1\span!;\endgroup} + \def\{{\string\{}\def\}{\string\}}% + \def\1{\string\1}\def\2{\string\2}\def\3{\string\3}% + \@makeother\$\@makeother\#\@makeother\^\@makeother\_\@makeother\~% + \@makeother\&\def\&{\rvorvstring{\string&}{\string&}}% req + \@makeother\<\def\<{\rvorvstring{\string<}{\string<}}% req + \@makeother\>\def\>{\rvorvstring{\string>}{\string>}}% + \@makeother\'\def\'{\rvorvstring{\string'}{\string'}}% + \@makeother\"\def\"{\rvorvstring{\string"}{\string"}}% + \let\cs\rt@cs + \rtpara@cont} +% \end{macrocode} +% \cs{rtpara} continues with \cs{rtpara@cont}. For pdfmarkup, we make special definitions +% that are not needed otherwise. \cs{makePDFSp} makes the space character into \cs{040}, +% \cs{insertPDFSp@tEOS} insert \cs{040} at the end of each line. +% \begin{macrocode} +\def\rtpara@cont{\ifpdfmarkup + \makePDFSp\obeyspaces\insertPDFSp@tEOL\fi + \@ifnextchar\bgroup\rtpara@cont@i{\expandafter + \rtpara@cont@i\@gobble}} +% \end{macrocode} +% Now we take the last parameter, which is the rich text markup. +% \begin{macrocode} +\def\rtpara@cont@i#1{% + \let\sup\rt@sup\let\sub\rt@sub + \let\br\rt@br\let\bf\rt@bf\let\it\rt@it + \let\spc\rt@spc + \let\span\rt@remove@span + \@rvstringfalse +% \end{macrocode} +% Inserting a space at the beginning of plain text does no harm, but has +% benefits; it betters matches the plain text with the rich context better. +% \changes{v1.0.4}{2018/08/05}{Inserted space when adding to plain text} +% \changes{v1.0.5}{2018/09/25}{Backing off that change} +% \begin{macrocode} + \edef\x{#1}\expandafter\@AddToPlainText\expandafter{\x}% + \let\span\relax + \@rvstringtrue + \rtpara@i#1\span!;\endgroup} % \end{macrocode} % Step 1: \cs{rtpara} comes here. % \begin{macrocode} \def\rtpara@i#1\span#2;{\def\argii{#2}% - \g@addto@macro\rt@RichText{#1}% - \ifx\argii\rt@excl - \rt@csarg\xdef{\rt@ctrlName-ri}% - {% - \rt@RichText

% - }% - \rt@csarg\xdef{\rt@ctrlName-pl}{\rt@PlainText}% - \let\rt@next\relax - \else - \def\rt@next{\rtpara@ii#2;}% - \fi + \@AddToRichText{#1}% + \ifx\argii\rt@excl + \rt@csarg\xdef{\rt@ctrlName-ri}% + {% + \rt@RichText

% + }% + \rt@csarg\xdef{\rt@ctrlName-pl}{\rt@PlainText}% + \let\rt@next\relax + \else + \def\rt@next{\rtpara@ii#2;}% + \fi \rt@next} % \end{macrocode} % Step 2: \cs{rtpara@i} comes here. % \begin{macrocode} \def\rtpara@ii#1#2#3;{\def\argii{#2}% - \ifx\argii\rt@excl - \let\rt@next\relax - \else - \let\span\rt@span - \let\br\rt@br\let\bf\rt@bf\let\it\rt@it + \ifx\argii\rt@excl + \let\rt@next\relax + \else + \let\span\rt@span + \let\br\rt@br\let\bf\rt@bf\let\it\rt@it % \end{macrocode} % We have encountered \cs{span\{\}\{\}} and we expand it appropriately. % \begin{macrocode} - \@rvstringtrue - \span{#1}{#2}\edef\rt@tmp{\noexpand\g@addto@macro - \noexpand\rt@RichText{\x}}\rt@tmp - \rt@csarg\xdef{\rt@ctrlName-ri}% - {% - \rt@RichText

% - }% - \rt@csarg\xdef{\rt@ctrlName-pl}{\rt@PlainText}% - \let\span\relax + \@rvstringtrue + \span{#1}{#2}\edef\rt@tmp{\noexpand + \@AddToRichText{\x}}\rt@tmp + \rt@csarg\xdef{\rt@ctrlName-ri}% + {% + \rt@RichText

% + }% + \rt@csarg\xdef{\rt@ctrlName-pl}{\rt@PlainText}% + \let\span\relax \def\rt@next{\rtpara@i#3;}% - \fi\rt@next} + \fi\rt@next} % \end{macrocode} % \end{macro} -% There is a special definition for \IndexKey{par}\texttt{par} and -% \IndexKey{skipline}\texttt{skipline}, these should be used between paragraphs to add +% There is a special definition for +% \IndexKey{skipline}\texttt{skipline}, \texttt{skipline} is used between paragraphs to add % a blank line between paragraphs. % \begin{macrocode} \rt@csarg\def{par-ri}{}\rt@csarg\def{par-pl}{\string\r} \rt@csarg\def{skipline-ri}% - {

\rt@amp - \rt@hashtag160;

} + {

\rt@amp + \rt@hashtag160;

} \rt@csarg\def{skipline-pl}{\string\r\space} \def\rt@skipline{skipline} \rt@csarg\def{br-ri}{}\rt@csarg\def{br-pl}{\string\r} @@ -602,66 +651,66 @@ % The \psf{DS} key sets the default style. According to the JavaScript API for Acrobat reference, % the default style supports alignment, textFont, (font family, font style, font weight), textColor, % and textSize -%\begin{verbatim} -% /DS(font: Helvetica,sans-serif 12.0pt;text-align:left;color:#000000) -% f=this.getField("RichText") -% style=f.defaultStyle; -% style.fontFamily; -% style.fontStyle; -% style.fontWeight; -% style.textFont; -% style.alignment; -% style.textColor; -% style.textSize; -%\end{verbatim} +%\begin{Verbatim}[xleftmargin=\parindent,codes={\catcode`\%=9},commandchars={!()}] +%/DS(font: Helvetica,sans-serif 12.0pt;text-align:left;color:#000000) +%f=this.getField("RichText") +%style=f.defaultStyle; +%style.fontFamily; +%style.fontStyle; +%style.fontWeight; +%style.textFont; +%style.alignment; +%style.textColor; +%style.textSize; +%\end{Verbatim} % \begin{macrocode} \def\rt@DSAttr{\ifx\rf@font\@empty\else\rf@font\rt@SC\fi - \ifx\rf@size\@empty\else\rf@size\rt@SC\fi - \ifx\rf@raise\@empty\else\rf@raise\rt@SC\fi - \ifx\rf@ul\@empty\ifx\rfS@strikeit\@empty\else - \rt@td\rt@CN\rfS@strikeit\rt@SC\fi - \else\rt@td\rt@CN\rf@ul\ifx\rfS@strikeit\@empty\else\space - \rfS@strikeit\fi\rt@SC\fi - \ifx\rfS@bold\@empty\else\rt@fw\rt@CN\rfS@bold\rt@SC\fi - \ifx\rfS@italic\@empty\else\rt@fs\rt@CN\rfS@italic\rt@SC\fi - \ifx\rf@color\@empty\else\rf@color\rt@SC\fi} + \ifx\rf@size\@empty\else\rf@size\rt@SC\fi + \ifx\rf@raise\@empty\else\rf@raise\rt@SC\fi + \ifx\rf@ul\@empty\ifx\rfS@strikeit\@empty\else + \rt@td\rt@CN\rfS@strikeit\rt@SC\fi + \else\rt@td\rt@CN\rf@ul\ifx\rfS@strikeit\@empty\else\space + \rfS@strikeit\fi\rt@SC\fi + \ifx\rfS@bold\@empty\else\rt@fw\rt@CN\rfS@bold\rt@SC\fi + \ifx\rfS@italic\@empty\else\rt@fs\rt@CN\rfS@italic\rt@SC\fi + \ifx\rf@color\@empty\else\rf@color\rt@SC\fi} % \end{macrocode} % \begin{macro}{\useDefaultDS} % A fixed definition for default \psf{DS}. % \begin{macrocode} \newcommand\useDefaultDS{font-family:Helvetica,sans-serif;% - font-size:12.0pt;font-style:normal;font-weight:normal;% - text-align:left;color:\rt@hashtag000000} + font-size:12.0pt;font-style:normal;font-weight:normal;% + text-align:left;color:\rt@hashtag000000} % \end{macrocode} % \end{macro} % \begin{macro}{\setDefaultStyle} -%\begin{verbatim} -% \setDefaultStyle{myDS}{font=Arial,...,color=#ff0000} -%\end{verbatim} +%\begin{Verbatim}[xleftmargin=\parindent,codes={\catcode`\%=9},commandchars={!()}] +%\setDefaultStyle{myDS}{font=Arial,...,color=ff0000} +%\end{Verbatim} % \begin{macrocode} \newcommand{\setDefaultStyle}[2]{\begingroup - \edef\x{\noexpand\setkeys{rtFont}{#2}}\x - \edef\x{\noexpand\setkeys{rtFontStyle}{\rf@style}}\x - \ifx\rf@ul\@empty\else - \let\rt@ul\@empty\PackageWarning{richtext}{% - The ul key is not supported within\MessageBreak - \string\setDefaultStyle. Ignoring it}\fi - \ifx\rf@raise\@empty\else - \let\rt@raise\@empty\PackageWarning{richtext}{% - The raise key is not supported within\MessageBreak - \string\setDefaultStyle. Ignoring it}\fi - \ifx\rt@url\@empty\else\let\rf@url\@empty - \PackageWarning{richtext}{% - The url key is not supported within\MessageBreak - \string\setDefaultStyle. Ignoring it}\fi + \edef\x{\noexpand\setkeys{rtFont}{#2}}\x + \edef\x{\noexpand\setkeys{rtFontStyle}{\rf@style}}\x + \ifx\rf@ul\@empty\else + \let\rt@ul\@empty\PackageWarning{richtext}{% + The ul key is not supported within\MessageBreak + \string\setDefaultStyle. Ignoring it}\fi + \ifx\rf@raise\@empty\else + \let\rt@raise\@empty\PackageWarning{richtext}{% + The raise key is not supported within\MessageBreak + \string\setDefaultStyle. Ignoring it}\fi + \ifx\rt@url\@empty\else\let\rf@url\@empty + \PackageWarning{richtext}{% + The url key is not supported within\MessageBreak + \string\setDefaultStyle. Ignoring it}\fi % \end{macrocode} % Fill in any missing essential attributes. % \begin{macrocode} - \ifx\rf@font\@empty - \def\rf@font{font-family:Helvetica,sans-serif}\fi - \ifx\rf@size\@empty\def\rf@size{font-size:\rf@size@pt}\fi - \ifx\rf@color\@empty\def\rf@color{color:\rt@hashtag000000}\fi - \rt@csarg\xdef{#1-DS}{\rt@DSAttr}% + \ifx\rf@font\@empty + \def\rf@font{font-family:Helvetica,sans-serif}\fi + \ifx\rf@size\@empty\def\rf@size{font-size:\rf@size@pt}\fi + \ifx\rf@color\@empty\def\rf@color{color:\rt@hashtag000000}\fi + \rt@csarg\xdef{#1-DS}{\rt@DSAttr}% \endgroup} % \end{macrocode} % \end{macro} @@ -684,92 +733,134 @@ % both to \cs{toks0}, which holds the \psf{RV} string, and to \cs{toks2}, which holds the \psf{V} string. % \begin{macrocode} \def\rt@addtoRVV#1{% - \toks4={\useRV{#1}}\edef\rt@tmpRV{\the\toks0\the\toks4}% - \toks4={\useV{#1}}\edef\rt@tmpV{\the\toks2\the\toks4}% - \toks0=\expandafter{\rt@tmpRV}\toks2=\expandafter{\rt@tmpV}% + \toks4={\useRV{#1}}\edef\rt@tmpRV{\the\toks0\the\toks4}% + \toks4={\useV{#1}}\edef\rt@tmpV{\the\toks2\the\toks4}% + \toks0=\expandafter{\rt@tmpRV}\toks2=\expandafter{\rt@tmpV}% } % \end{macrocode} % We begin \cmd{\setRVVContent} % \begin{macrocode} \def\rt@testifbgroup{\@ifnextchar\bgroup - {\let\rt@nultiargs=1\rt@gobbletonil} - {\let\rt@nultiargs=0\rt@gobbletonil}} + {\let\rt@nultiargs=1\rt@gobbletonil} + {\let\rt@nultiargs=0\rt@gobbletonil}} \newcommand{\setRVVContent}[2]{\begingroup - \rt@firsttoktrue \rt@itsskiplinefalse - \rt@testifbgroup#2\@nil - \def\contName{#1}\toks0={}\toks2={}\toks4={}% - \if\rt@nultiargs1\def\rt@next{\setRVVContent@i#2;}\else - \def\rt@next{\setRVVContent@i{#2};}\fi\rt@next} + \rt@firsttoktrue \rt@itsskiplinefalse + \rt@testifbgroup#2\@nil + \def\contName{#1}\toks0={}\toks2={}\toks4={}% + \if\rt@nultiargs1\def\rt@next{\setRVVContent@i#2;}\else + \def\rt@next{\setRVVContent@i{#2};}\fi\rt@next} \def\setRVVContent@i#1{\def\rt@argi{#1}% - \ifx\rt@argi\rt@SC + \ifx\rt@argi\rt@SC % \end{macrocode} % If a semi-colon (\cs{rt@SC}), we are finished. Make the definitions % for \psf{RV} and \psf{V}, and exit. % \begin{macrocode} - \rt@csarg\xdef{\contName-vcont}{\the\toks0}% - \rt@csarg\xdef{\contName-pcont}{\the\toks2}% - \let\rt@next\endgroup - \else + \rt@csarg\xdef{\contName-vcont}{\the\toks0}% + \rt@csarg\xdef{\contName-pcont}{\the\toks2}% + \let\rt@next\endgroup + \else % \end{macrocode} % See if the current argument has been declared earlier by \cs{rtpara}. % If not, we issue a warning and ignore it. % \begin{macrocode} - \expandafter\ifx\csname #1-ri\endcsname\relax - \PackageWarning{richtext} - {The name '#1' is not declared,\MessageBreak - will ignore it. Check the spelling}% - \def\rt@next{\setRVVContent@i}% - \else + \expandafter\ifx\csname #1-ri\endcsname\relax + \PackageWarning{richtext} + {The name '#1' is not declared,\MessageBreak + will ignore it. Check the spelling}% + \def\rt@next{\setRVVContent@i}% + \else % \end{macrocode} % We want to automatically induce \texttt{par} between non-\texttt{lineskip} % tokens. The automatic \texttt{par} goes in prior to the token, so we first % skip the first token. % \begin{macrocode} - \ifrt@firsttok\rt@firsttokfalse\else + \ifrt@firsttok\rt@firsttokfalse\else % \end{macrocode} % Not the first token, see if it is a \texttt{skipline}, if yes, register it % as a skip line for the next token. % \begin{macrocode} - \ifx\rt@argi\rt@skipline - \rt@itsskiplinetrue - \else + \ifx\rt@argi\rt@skipline + \rt@itsskiplinetrue + \else % \end{macrocode} % If the previous token was a \texttt{skipline}, we don't induce a \texttt{par}. % \begin{macrocode} - \ifrt@itsskipline - \rt@addtoRVV{br}\rt@itsskiplinefalse - \else + \ifrt@itsskipline + \rt@addtoRVV{br}\rt@itsskiplinefalse + \else % \end{macrocode} % Finally, if this is not a \texttt{skipline}, and the previous token is not a \texttt{skipline}, % we induce a \texttt{par}. % \begin{macrocode} - \rt@addtoRVV{par}% - \fi - \fi - \fi - \rt@addtoRVV{#1}% - \def\rt@next{\setRVVContent@i}% + \rt@addtoRVV{par}% + \fi \fi - \fi\rt@next + \fi + \rt@addtoRVV{#1}% + \def\rt@next{\setRVVContent@i}% + \fi + \fi\rt@next } % \end{macrocode} % \end{macro} -% \begin{macro}{\useRVContent} -% \verb!\useRVConent{}! -% \begin{macro}{\useVContent} -% \verb!\useVConent{}! +% \begin{macro}{\useRVContent}\hskip-\marginparsep\texttt{\darg{\ameta{name}}} +% Used to combine several paragraphs (\psf{RV}) % \begin{macrocode} \def\useRVContent#1{\@nameuse{#1-vcont}} -\def\useVContent#1{\@nameuse{#1-pcont}} % \end{macrocode} % \end{macro} +% \begin{macro}{\useVContent}\hskip-\marginparsep\texttt{\darg{\ameta{name}}} +% Used to combine several paragraphs (\psf{V}) +% \begin{macrocode} +\def\useVContent#1{\@nameuse{#1-pcont}} +% \end{macrocode} % \end{macro} +% \section{Typesetting rich text mark up} +% It may be case that an author may want to display the underlying rich text markup and +% typeset it into the document for inspection and discussion. For this purpose, we offer +% \begin{macrocode} +% \end{macrocode} +% \leavevmode\DescribeEnv{displayRtPara}\hskip-\marginparsep\texttt{\darg{\ameta{name}}} +% Place an \cs{rtpara} command within and get a readout of RV and with \cs{displayRV\darg{\ameta{name}}} +% and \cs{displayV\darg{\ameta{name}}}. +% \changes{v1.1}{2020/06/28}{Added \string\env{displayRtPara} and \string\env{displayRtPara*}} +% \begin{macrocode} +\newenvironment{displayRtPara}[1]{% + \gdef\displayRtParaName{#1}\let\rtpdfSPDef\rt@sp@ce + \let\makePDFSp\makeTeXSp\let\rt@spc\rt@sp@ce + \def\rt@SC{;\allowbreak}\def\rt@CN{:\allowbreak}% +}{% + \rt@csarg\xdef{displayRV\displayRtParaName}% + {\useRV{\displayRtParaName}} + \rt@csarg\xdef{displayV\displayRtParaName}% + {\useV{\displayRtParaName}} +} +% \end{macrocode} +% \leavevmode\DescribeEnv{displayRtPara*}\hskip-\marginparsep\texttt{\darg{\ameta{name}}} +% Place an \cs{rtpara} command within and get a readout of RV and with \cs{displayRV\darg{\ameta{name}}} +% and \cs{displayV\darg{\ameta{name}}}. In this version, spaces are displayed as \cs{040}, designed for +% the \app{dvips\,\texttt{->}\,distiller} workflow. Prints the same result for all other workflows as \env{displayRtPara}. +% \begin{macrocode} +\newenvironment{displayRtPara*}[1]{% + \gdef\displayRtParaName{#1}\let\rtpdfSPDef\rtpdfSPDefPrnt + \let\makePDFSp\makeTeXSpPrnt\let\rt@spc\rtpdfSPDefPrnt + \def\rt@SC{;\allowbreak}\def\rt@CN{:\allowbreak}% +}{% + \rt@csarg\xdef{displayRV\displayRtParaName}% + {\useRV{\displayRtParaName}} + \rt@csarg\xdef{displayV\displayRtParaName}% + {\useV{\displayRtParaName}} +} +% \end{macrocode} +% \leavevmode\DescribeMacro\displayRV\hskip-\marginparsep\texttt{\darg{\ameta{name}}} displays +% the \psf{RV} entry as defined by a \cs{rtpara} command with \ameta{name}. Similarly, +% \DescribeMacro\displayV\cs{displayV\darg{\ameta{name}}} displays the \psf{V} entry +% \changes{v1.1}{2020/06/28}{Added \string\cs{displayRV} and \string\cs{displayV}} +% \begin{macrocode} +\def\displayRV#1{\csname displayRV#1\endcsname} +\def\displayV#1{\csname displayV#1\endcsname} +% \end{macrocode} % \begin{macrocode} %
% \end{macrocode} \endinput - -% iPad -% Landscape -% w: 7.75in -% h: 5.8in -- cgit v1.2.3