From 23ee8dddbfe6184e565c68b5b696f5b2067bec4e Mon Sep 17 00:00:00 2001 From: Nathan Wallach Date: Fri, 2 Aug 2019 00:56:39 +0300 Subject: [PATCH] 1. Reinsert the $externalPrograms{pdflatex} setting in conf/site.conf.dist as it was removed in commit bea85e1 apparently by accident. The hard copy generation code in lib/WeBWorK/ContentGenerator/Hardcopy.pm and the web service hard PDF generation code in lib/WebworkWebservice/MathTranslators.pm both expect this setting to exist. 2. Changes to support multilingual PDF generation using XeLaTeX and polyglossia. My test case was English+Hebrew, so I have added XeLaTeX conf/snippets/hardcopyThemes directories for using polyglossia for English and English+Hebrew. Testing requires using xelayex and having all of the following installed: the culmus Hebrew fonts, LaTeX pakages: polyglossia, fontspec, xunicode. conf/localOverrides.conf.dist contains sample code to use the new themes. The code in lib/WeBWorK/ContentGenerator/Hardcopy.pm which displays the available hardcopyThemes options was changed to avoid the use of maketext. Local installations may have local hardcopyThemes and they will not have entries in the PO translations files, and the prior code would trigger errors as a result. Note: The version of xelatex and various latex packages in Ubuntu 16.04 did not manage to compile the Hebrew+English latex files I tested, but they compile under Ubuntu 18.04 with the same packages. --- conf/localOverrides.conf.dist | 32 +++++++ conf/site.conf.dist | 6 ++ .../hardcopyPostamble.tex | 3 + .../hardcopyPreamble.tex | 80 +++++++++++++++++ .../hardcopyProblemDivider.tex | 6 ++ .../hardcopySetDivider.tex | 4 + .../hardcopySetFooter.pg | 26 ++++++ .../hardcopySetHeader.pg | 71 +++++++++++++++ .../hardcopyUserDivider.tex | 3 + .../hardcopyPostamble.tex | 4 + .../hardcopyPreamble.tex | 85 ++++++++++++++++++ .../hardcopyProblemDivider.tex | 6 ++ .../hardcopySetDivider.tex | 8 ++ .../hardcopySetFooter.pg | 27 ++++++ .../hardcopySetHeader.pg | 71 +++++++++++++++ .../hardcopyUserDivider.tex | 7 ++ .../XeLaTeX-oneColumn/hardcopyPostamble.tex | 3 + .../XeLaTeX-oneColumn/hardcopyPreamble.tex | 83 +++++++++++++++++ .../hardcopyProblemDivider.tex | 6 ++ .../XeLaTeX-oneColumn/hardcopySetDivider.tex | 4 + .../XeLaTeX-oneColumn/hardcopySetFooter.pg | 24 +++++ .../XeLaTeX-oneColumn/hardcopySetHeader.pg | 71 +++++++++++++++ .../XeLaTeX-oneColumn/hardcopyUserDivider.tex | 3 + .../XeLaTeX-twoColumn/hardcopyPostamble.tex | 4 + .../XeLaTeX-twoColumn/hardcopyPreamble.tex | 88 +++++++++++++++++++ .../hardcopyProblemDivider.tex | 6 ++ .../XeLaTeX-twoColumn/hardcopySetDivider.tex | 8 ++ .../XeLaTeX-twoColumn/hardcopySetFooter.pg | 19 ++++ .../XeLaTeX-twoColumn/hardcopySetHeader.pg | 71 +++++++++++++++ .../XeLaTeX-twoColumn/hardcopyUserDivider.tex | 7 ++ lib/WeBWorK/ContentGenerator/Hardcopy.pm | 4 +- 31 files changed, 839 insertions(+), 1 deletion(-) create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg create mode 100644 conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex diff --git a/conf/localOverrides.conf.dist b/conf/localOverrides.conf.dist index 82c449ec4c..27607ff2b9 100644 --- a/conf/localOverrides.conf.dist +++ b/conf/localOverrides.conf.dist @@ -512,4 +512,36 @@ $options{useOPLdefFiles}=1; $permissionLevels{show_answer_group_info_checkbox} = "admin"; $permissionLevels{modify_tags} = "admin"; + +################################################################################ + +# Available Hardcopy themes (located in snippets) - adds four XeLaTeX themes +# using polyglossia for multilingual support and fontspec. + +$hardcopyThemes = [ qw ( + oneColumn + twoColumn + XeLaTeX-oneColumn + XeLaTeX-twoColumn + XeLaTeX-Hebrew-oneColumn + XeLaTeX-Hebrew-twoColumn +)]; + +# Hardcopy theme names (pretty names for themes) +$hardcopyThemeNames = { + oneColumn => 'pdfLaTeX - English - One Column', + twoColumn => 'pdfLaTeX - English - Two Columns', + XeLaTeX-oneColumn => 'XeLaTeX - English - one Column', + XeLaTeX-twoColumn => 'XeLaTeX - English - two Columns', + XeLaTeX-Hebrew-oneColumn => 'XeLaTeX - Hebrew/English - one Column', + XeLaTeX-Hebrew-twoColumn => 'XeLaTeX - Hebrew/English - two Columns', +}; + +# Change default Hardcopy theme - in order to use an XeLaTeX theme, we must set +# $externalPrograms{pdflatex} to use xelatex (here or in site.conf) !!! +#$hardcopyTheme = "XeLaTeX-twoColumn"; +#$externalPrograms{pdflatex} ="/usr/bin/xelatex --shell-escape"; + +################################################################################ + 1; #final line of the file to reassure perl that it was read properly. diff --git a/conf/site.conf.dist b/conf/site.conf.dist index 9485105f0f..15570d5d70 100644 --- a/conf/site.conf.dist +++ b/conf/site.conf.dist @@ -104,6 +104,12 @@ $externalPrograms{git} = "/usr/bin/git"; # equation rendering/hardcopy utiltiies #################################################### $externalPrograms{latex} ="/usr/bin/latex"; + +$externalPrograms{pdflatex} ="/usr/bin/pdflatex --shell-escape"; +# Consider using xelatex instead of pdflatex for multilingual use, and +# use polyglossia and fontspec packages (which require xelatex or lualatex). +#$externalPrograms{pdflatex} ="/usr/bin/xelatex --shell-escape"; + $externalPrograms{dvipng} ="/usr/bin/dvipng"; #################################################### diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e831736a7 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPostamble.tex @@ -0,0 +1,3 @@ + +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..94abacd10d --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyPreamble.tex @@ -0,0 +1,80 @@ +\batchmode +\documentclass[11pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia - using Hebrew and the Culmus fonts +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} + +% bidi needs to be loaded AFTER caption,xcolor +\usepackage{bidi} + +\setdefaultlanguage{hebrew} +\setotherlanguage{english} +\setmainfont{Frank Ruehl CLM} +\setmonofont{Miriam Mono CLM} +\setsansfont{Simple CLM} + +% When using default English +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. +% +% When using default Hebrew +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} +\usepackage{fullpage} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% This is used to signal PG that we are not using multicols +\newcommand{\nocolumns}{} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\newpage +\setcounter{page}{1} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..a66b59253a --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetDivider.tex @@ -0,0 +1,4 @@ + +\newpage% +\setcounter{page}{1}% + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..cb6b9be060 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetFooter.pg @@ -0,0 +1,26 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BR + +\newfontfamily\libertine{Linux Libertine O} + +\begin{english} +\noindent {\tiny Generated by WeBWorK {\libertine \copyright}} +\end{english} + +\begin{hebrew} +\noindent{\tiny נוצר על ידי \textenglish{WeBWorK} {\libertine \copyright}} +\end{hebrew} + +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..25cb763f38 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-oneColumn/hardcopyUserDivider.tex @@ -0,0 +1,3 @@ + +\newpage% +\setcounter{page}{1}% diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e46f0cdb3 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPostamble.tex @@ -0,0 +1,4 @@ + +\end{multicols} +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..b9c5983e1a --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyPreamble.tex @@ -0,0 +1,85 @@ +\batchmode +\documentclass[10pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia - using Hebrew and the Culmus fonts +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} + +% bidi needs to be loaded AFTER caption,xcolor +\usepackage{bidi} + +\setdefaultlanguage{hebrew} +\setotherlanguage{english} +\setmainfont{Frank Ruehl CLM} +\setmonofont{Miriam Mono CLM} +\setsansfont{Simple CLM} + +% When using default English +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. +% +% When using default Hebrew +% Use \begin{hebrew} block of text \end{hebrew} for paragraphs. + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\textheight 9in +\oddsidemargin = -0.42in +\evensidemargin = -0.42in +\textwidth= 7.28in +\columnsep = .25in +\columnseprule = .4pt +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\voffset=-0.8in +\newpage +\setcounter{page}{1} +\begin{multicols}{2} +\columnwidth=\linewidth diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..2832139795 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetDivider.tex @@ -0,0 +1,8 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..28597e4dd1 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetFooter.pg @@ -0,0 +1,27 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BEGIN_ONE_COLUMN + +\newfontfamily\libertine{Linux Libertine O} + +\begin{english} +\noindent {\tiny Generated by WeBWorK {\libertine \copyright}} +\end{english} + +\begin{hebrew} +\noindent{\tiny נוצר על ידי \textenglish{WeBWorK} {\libertine \copyright}} +\end{hebrew} + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..a23eb585dc --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-Hebrew-twoColumn/hardcopyUserDivider.tex @@ -0,0 +1,7 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e831736a7 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPostamble.tex @@ -0,0 +1,3 @@ + +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..098e7be374 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyPreamble.tex @@ -0,0 +1,83 @@ +\batchmode +\documentclass[11pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} +\setdefaultlanguage{english} +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can set TTF/OTF fonts, ex with +%\setmainfont{main font name} +%\setmonofont{mono font name} +%\setsansfont{sans font name} + + +% If needed - can load the bidi package to support RTL and LTR languages +% using automatic direction changes (where it works) for Unicode UTF-8 +% encoded text. +% The bidi package needs to be loaded AFTER caption, xcolor. +%\usepackage{bidi} + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} +\usepackage{fullpage} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% This is used to signal PG that we are not using multicols +\newcommand{\nocolumns}{} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\newpage +\setcounter{page}{1} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..a66b59253a --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetDivider.tex @@ -0,0 +1,4 @@ + +\newpage% +\setcounter{page}{1}% + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..f6e1baf3ee --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetFooter.pg @@ -0,0 +1,24 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BR + +\begin{english} +\noindent {\tiny Generated by WeBWorK \copyright} +\end{english} + +\begin{hebrew} +\noindent{\tiny נוצר על ידי \textenglish{WeBWorK} \copyright} +\end{hebrew} + +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..25cb763f38 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-oneColumn/hardcopyUserDivider.tex @@ -0,0 +1,3 @@ + +\newpage% +\setcounter{page}{1}% diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex new file mode 100644 index 0000000000..8e46f0cdb3 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPostamble.tex @@ -0,0 +1,4 @@ + +\end{multicols} +\vfill +\end{document} diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex new file mode 100644 index 0000000000..02702e2cae --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyPreamble.tex @@ -0,0 +1,88 @@ +\batchmode +\documentclass[10pt]{amsart} +\usepackage{amsmath,amsfonts,amssymb,multicol} + +% For XeLaTeX + polyglossia +\usepackage{fontspec} +\usepackage{xunicode} + +\usepackage{booktabs,tabularx,colortbl,caption,xcolor} + +% Load the polyglossia package to support multiple languages. +% see https://ctan.org/pkg/polyglossia +\usepackage{polyglossia} +\setdefaultlanguage{english} +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can add additional languages +%\setotherlanguage{supported_language} + +% Can set TTF/OTF fonts, ex with +%\setmainfont{main font name} +%\setmonofont{mono font name} +%\setsansfont{sans font name} + + +% If needed - can load the bidi package to support RTL and LTR languages +% using automatic direction changes (where it works) for Unicode UTF-8 +% encoded text. +% The bidi package needs to be loaded AFTER caption, xcolor. +%\usepackage{bidi} + +\usepackage{path} + \discretionaries |~!@$%^&*()_+`-=#{"}[]:;'<>,.?\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789| +\usepackage{graphicx} + +% There is no support for epstopdf in xelatex, but it supports eps files natively +%\usepackage{epstopdf} % allows use of eps files + +% WeBWorK used Control+_ = ^_ for verbatim... so we change its charcode +\catcode`\=12 + +\usepackage{epsf} +\usepackage{epsfig} +\usepackage{pslatex} + +% Comment out 3 lines - XeLaTeX supports UTF-8 and the euro symbol already +%\usepackage[utf8]{inputenc} +%\usepackage{eurosym} % the euro symbol +%\DeclareUnicodeCharacter{20AC}{\euro} % make it possible to use the UTF-8 character for the euro symbol in problems + +\pagestyle{plain} +\textheight 9in +\oddsidemargin = -0.42in +\evensidemargin = -0.42in +\textwidth= 7.28in +\columnsep = .25in +\columnseprule = .4pt +\def\endline{\bigskip\hrule width \hsize height 0.8pt } +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% BEGIN capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} + +% END capa tex macros + +\begin{document} +\voffset=-0.8in +\newpage +\setcounter{page}{1} +\begin{multicols}{2} +\columnwidth=\linewidth diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex new file mode 100644 index 0000000000..4ccf3ac14c --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyProblemDivider.tex @@ -0,0 +1,6 @@ + +\medskip +\goodbreak +\hrule +\nobreak +\smallskip diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex new file mode 100644 index 0000000000..2832139795 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetDivider.tex @@ -0,0 +1,8 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set + diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg new file mode 100644 index 0000000000..b3cfb96c4f --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetFooter.pg @@ -0,0 +1,19 @@ +# +# hardcopySetFooter.pg - generic hardcopy set footer file +# + +DOCUMENT(); +loadMacros( + "PG.pl", + "PGbasicmacros.pl" +); + +BEGIN_TEXT +$BEGIN_ONE_COLUMN + +\noindent {\tiny Generated by \copyright WeBWorK, http://webwork.maa.org, Mathematical Association of America} + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg new file mode 100644 index 0000000000..7a357d2d13 --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopySetHeader.pg @@ -0,0 +1,71 @@ +DOCUMENT(); + +loadMacros( + "PG.pl", + "PGbasicmacros.pl", +); + +TEXT($BEGIN_ONE_COLUMN); + +TEXT(MODES(TeX =>EV3(<<'EOT'),HTML=>"",Latex2HTML=>"")); +\noindent {\large \bf $studentName} +\hfill +\noindent {\large \bf MTH 161 $sectionNumber Fall 2003} +\par + +EOT + +BEGIN_TEXT + +$BBOLD WeBWorK assignment number $setNumber is due : $formattedDueDate. $EBOLD + +$PAR +The +(* home page *) +\{ +#htmlLink(qq!http://www.math.rochester.edu/courses/161/home/!,"home +page") +\} +for the course contains the syllabus, grading policy and other +information. +$PAR +END_TEXT + +################## +# EDIT BELOW HERE +################## +BEGIN_TEXT +$HR +$PAR +This file is /conf/snippets/hardcopySetHeader.pg you can use it as +a model for creating files which introduce each problem set. +$PAR +$HR +END_TEXT +################## +# EDIT ABOVE HERE +################## +BEGIN_TEXT +The primary purpose of WeBWorK is to let you know that you are getting the correct answer or to alert +you if you are making some kind of mistake. Usually you can attempt a problem as many times as you want before +the due date. However, if you are having trouble figuring out your error, you should +consult the book, or ask a fellow student, one of the TA's or +your professor for help. Don't spend a lot of time guessing -- it's not very efficient or effective. +$PAR +Give 4 or 5 significant digits for (floating point) numerical answers. +For most problems when entering numerical answers, you can if you wish +enter elementary expressions such as \( 2\wedge3 \) instead of 8, \( sin(3*pi/2) \)instead +of -1, \( e\wedge (ln(2)) \) instead of 2, +\( (2+tan(3))*(4-sin(5))\wedge6-7/8 \) instead of 27620.3413, etc. + Here's the +\{ htmlLink(qq!http://webwork.math.rochester.edu/docs/docs/pglanguage/availableFunctions.html!,"list of the functions") \} + which WeBWorK understands. +$PAR +You can use the Feedback button on each problem +page to send e-mail to the professors. + + +$END_ONE_COLUMN +END_TEXT + +ENDDOCUMENT(); # This should be the last executable line in the problem. diff --git a/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex new file mode 100644 index 0000000000..a23eb585dc --- /dev/null +++ b/conf/snippets/hardcopyThemes/XeLaTeX-twoColumn/hardcopyUserDivider.tex @@ -0,0 +1,7 @@ + +\end{multicols} % close off the columns from the set above + +\newpage% +\setcounter{page}{1}% +\begin{multicols}{2} +\columnwidth=\linewidth % reopen the columns for the following set diff --git a/lib/WeBWorK/ContentGenerator/Hardcopy.pm b/lib/WeBWorK/ContentGenerator/Hardcopy.pm index 1bd3c554b8..584a217a02 100644 --- a/lib/WeBWorK/ContentGenerator/Hardcopy.pm +++ b/lib/WeBWorK/ContentGenerator/Hardcopy.pm @@ -566,7 +566,9 @@ sub display_form { } - my %hardcopyThemeNames = map {$_ => $r->maketext($ce->{hardcopyThemeNames}->{$_})} @{$ce->{hardcopyThemes}}; + # Using maketext on the next line would trigger errors when a local hardcopyTheme is installed. + # my %hardcopyThemeNames = map {$_ => $r->maketext($ce->{hardcopyThemeNames}->{$_})} @{$ce->{hardcopyThemes}}; + my %hardcopyThemeNames = map {$_ => $ce->{hardcopyThemeNames}->{$_}} @{$ce->{hardcopyThemes}}; print CGI::table({class=>"FormLayout"}, CGI::Tr({},