Ceci est une ancienne révision du document !
This time we will play with a few of the packages stored under the E topic. There are lots to choose from – with 27 topics. As usual I will skip the sets of packages designed for a specific language. This time the languages include English, Esperanto and Estonian. Even though Donald Knuth worked in English, and designed the first versions of Tex for English speakers, there are packages which are specific to the typographical needs for written English. My next column will be an introduction to using Latex with languages other than English.
The first package for this column can be fun. It is called ‘epigraph’. The audience asks what is an epigraph? An epigraph is a short, usually pithy comment or quotation that often appears at the beginning of a document or chapter. You have probably seen epigraphs, but perhaps not thought about how to add them to your own work. The epigraph package provides commands for typesetting a single epigraph as well as environments for typesetting a list of epigraphs according to the documentation.
Of course the command \usepackage{epigraph} must appear in the preamble to your Latex document, i.e. before the \begin{document} command, and after the \documentclass command. In the document, use the following syntax for one epigraph (see graphic):
\epigraph{text}{source}
The text will be placed at the right side of the text block, the source is placed below and on the right side of the text. {text} refers to the quotation you wish to appear. I prefer epigraphs to be centred on the page. That can be done using the \epigraphflush{center} command. Other options include adjusting the width or thickness of the line that separates the text from the source, adjusting the type-size of the epigraph, adjusting the white space before and after the epigraph. There are more advanced settings described in the documentation. There are also some examples in the thirteen-page documentation. As I have said before, if you are interested in using a particular package that is new to you (epigraphs for example), take some time to read the documentation and to experiment with the various commands.
Next I will look at a package that I wished I knew about when I was writing quizzes and exams for my college students. It is called ‘exercisebank’, and is a tool to build data banks of questions and then to import chosen questions into tests and exams. The questions are stored in a file you name and in a location you select (see illustration). \documentclass{article} \usepackage[]{exercisebank} \exercisebanksetup{exercise directory=exercises} \makeset{myExerciseSet}{myexercises} \begin{document} \buildset{myExerciseSet} \end{document}
And this is the basic structure of a list of questions.
\begin{intro}
This introduces our problem.
\end{intro} \begin{problem}
This is part problem 1.
\end{problem} \begin{problem}
This is part problem 2.
\end{problem} \begin{problem}
This is problem 3.
\end{problem}
Of course if all that a question bank needs is statements, then there would be no need for a special package. I would simply type the statements or questions into a word processing file and ask the print shop to make however many copies I need.
This package allows the knowledgeable user to pick which questions are used in any particular test, allows questions to be tagged (i.e. labelled) to indicate degree of difficulty, and allows questions to have different marks assigned to them. A user can build more than one question bank and draw questions for a test (or assignment) from more than one question bank. For example, the text has twenty chapters so I write twenty sets of questions. At mid-term I can give a test pulling selected questions from each of the first ten chapters.
Solutions to problems can be added directly to the question bank. By default, solutions do not display or print (do not appear in the PDF) unless the user requests them. For example:
\begin{problem}
What is 2 * 6?
\end{problem} \begin{solution}
12
\end{solution}
Graphics can be included in the problem sets (question banks). Graphics can be existing files or graphics generated using one of Latex’s image tools (chemfig and tikz in FCM 193, for example).
The first six pages of the 25-page documentation “cover the basics” as the author says. The rest of the documentation is an annotated list of commands in alphabetical order. If you download the package from ctan.org, you will also get a sample question bank with a problem with a graphic.
This seems to me to be a very powerful complex package with many options. I would like to have several worked examples of typical instructor tasks and examples of different types of questions (multiple choice, true / false, matching, etc). Searching through twenty pages of commands to find the few I need, while facing a production deadline for an assignment or test, is not my idea of fun. Having now written about more than twenty packages in these pages, and having examined at least twenty more, I think the documentation for complex packages is the weakest part of these packages. It is well-known that IT people are weak when it comes to documentation. I would like the package owners to think of their documentation as user manuals. Help users finish their first few projects with your package, otherwise they will not remain users for long.
The next package this time is the ‘comment’ package, latest revision 2016 August. The author says the package allows the user to “selectively in/exclude pieces of text: the user can define new comment versions and each is controlled separately.” It works by setting up a comment environment. Any context within this environment is ignored when the document is compiled. See examples using comment and not using comment. Notice how the first paragraph is repeated when the comment code is removed from the source file.
\documentclass[letterpaper,12pt]{article} \usepackage[]{comment} \usepackage{lipsum} \begin{document}
\lipsum[1-1]
%\begin{comment}
\lipsum[1-1]
%\end{comment}
\lipsum[2-2]
\end{document}
Comments can be made conditional. By default, once defined, the comment environment contents are global in the document. They can be made local using the begingroup / endgroup commands. Comment commands can be made special and be defined by the user. There are some other specialized commands available in the four page documentation. This looks like it could be quite useful when preparing various versions of a document, either for various readers or in order to record various revisions and potential edits.
One more package before I finish looking at the packages in the “E” topic, an older one called ‘ulem’. Take a look at the image and the code below.
\documentclass[letterpaper,12pt]{article} \usepackage[]{ulem} \begin{document}
Copied from the documentation for the ulem package.
The ulem package provides various types of underlining that can stretch between words and be broken across lines. Use it with Latex or plain Tex.
In Latex ulem normally replaces italics with underlining in text emphasized by \uline{emph}, and to some extent by \uuline{em}. A declaration of \uwave{normalem} or the \dashuline{usepackage} option [normalem] disables this feature.
\end{document}
The ulem package also has sout, xout and dotuline commands: strikeout, mark each letter with an oblique line and underline with dots (see illustration). Other styles of underlining can be user defined. One small warning: because each underlined word is placed in a text box, automatic hyphenation for that word is disabled. The six pages of documentation are easy to understand and have enough examples so the user can experiment without problems.
Next time, we will start an examination of the babel package hoping to learn how to use it to write text in various languages. I can write in only English, French, Latin, ancient Greek and Chinese. I hope that that will be enough choices so we can explore babel together.