I've done some technical reports with LaTeX and learnt something about it. There are some useful packages and classes in CTAN that I've tried.
The first one is refman
, without recents upgrades but very powerful. Look at this sample and its code.
Another try was using KOMA-Script with some customization. Look at a sample and its code. I'm really proud of the results.
Finally, I recently found the hitec
package that I'm yet trying, sorry for not offering any sample.
I hope this could help you.
Here's the framework for an answer, based on @Ignasi's suggestion. Documentation for the combine
package (http://tug.ctan.org/tex-archive/macros/latex/contrib/combine/combine.pdf) will help you play with formatting, make the toc work, even generate an index and a table of figures.
The student gets two files, preamble.tex
(read only if possible) and template.tex
. She fills in the template, compiles it and submits it with a new name along with her image files (you have to establish the naming conventions).
The preamble:
% preamble.tex
% provided to students, read only
\documentclass[12pt,notitlepage]{article}
\usepackage{graphicx}
\newcommand{\theschool}{to be renewed}
\newcommand{\school}[1]{%
\renewcommand{\theschool}{#1}
}
\newcommand{\theteacher}{to be renewed}
\newcommand{\teacher}[1]{%
\renewcommand{\theteacher}{#1}
}
% hack the \date field of \maketitle
\date{School: \theschool{} -- Teacher: \theteacher{}}
\newcommand{\myfigure}[2]{%
\centering
\includegraphics[height=3cm]{#1}\\
Caption: #2
}
\begin{document}
\newcommand{\alldone}{\end{document}}
template.tex
, saved as plato.tex
:
% template for students to fill in
%
\input{preamble}
\author{Plato}
\title{The Republic}
\school{Athens}
\teacher{Socrates}
\maketitle
\begin{abstract}
\emph{The Republic} in one short paragraph \ldots
\end{abstract}
% first argument is image (.jpg, .png, .pdf)
% second argument is figure caption
\myfigure{therepublic}{Image from wikipedia}
\alldone
Compiles to
The wrapper is putittogether.tex
, in the directory with student submissions and an empty preamble.tex
. I compiled and tested it with a second saved template - code not included here.
% putittogether.tex
\documentclass[12pt]{combine}
% macros from the preamble seen by the students
\usepackage{graphicx}
\newcommand{\theschool}{to be renewed}
\newcommand{\school}[1]{%
\renewcommand{\theschool}{#1}
}
\newcommand{\theteacher}{to be renewed}
\newcommand{\teacher}[1]{%
\renewcommand{\theteacher}{#1}
}
\newcommand{\hackdate}{%
\date{School: \theschool{} -- Teacher: \theteacher{}}
}
\newcommand{\myfigure}[2]{%
\centering
\includegraphics[height=3cm]{#1}\\
Caption: #2
}
% The \date must be renewed between \imports
\newcommand{\goget}[1]{%
\hackdate{}\import{#1}
}
\newcommand{\alldone}{} % do nothing
% Combine package configuration
\title{All Together Now}
\author{many authors}
\date{\today}
\begin{document}
\pagestyle{combine} % use the combine page style
\maketitle % main title
\tableofcontents % main ToC
\clearpage
% The files to glue together - all in this directory,
% along with all graphics files required.
%
% Generate this list with a script, then \include it here.
\goget{plato}
\goget{vonneumann}
\end{document}
Best Answer
Based on my comments, here is an answer. To write a document class, all you need (really) is to create a file, say,
myclass.cls
, and put it in the same place as your document; then it can be loaded with\documentclass{myclass}
and any macros defined in it will be available to the document. The documentclsguide.pdf
that Higgs Boson linked describes all the various structured commands you ought to put in your class in order to give it a standardized appearance. For example, you can declare its version and the version of LaTeX you need it to use, load other packages or classes in it, and accept options in the form\documentclass[option,option2]{myclass}
.As far as creating a class, no special software is needed. A
.cls
file is exactly the same as any.tex
file and you can write it in whatever text editor you normally write LaTeX documents in (perhaps you are using WinEdt, for example?). There are a few questions around this site about what editors are recommended; this one is a pretty big list.If you are a beginner, you can look at existing classes for inspiration. For example, since you are building an exam class, you might look at exam.cls, which (though quite complex) is well-written and well-commented, so you might learn something about what a document class typically does. Also see their documentation.
I should say that if you are really a beginner, you should not be writing a class at all, and this example of a real documentclass will probably make no sense to you. Start out by defining some new commands and environments in the default
article
class. You can spin them off into an independent package later.