1

I would like to create a detailed course guide for my class in LaTeX, with each lesson outlined with detailed lesson objectives. I would also like to use that same document to embed in it teaching notes. This way, I have one document that is both the course guide that is issued to students, and the teaching guide that instructors can use to teach the class.

I would like to define an environment such that the teaching content can be "turned on" and visible. But I can also turn it off, and the remaining text would be the course guide for students. This would be similar to the exam class, where you can have answers revealed or not, controlled with an option on the document class line. I don't want to invent an entire document class, just something where the teacher edition can be turned on with just one line at the top.

I know how to define environments, but is there a way that this can turned on/off globally from one line at the top?

  • 1
    Does the comment package do what you need? (I think so.) – Harald Hanche-Olsen Jul 4 '18 at 14:19
  • If you need even more than what comment provides you could have a look at multiaudience. – TeXnician Jul 4 '18 at 14:21
  • i haven't time to write an answer at the moment, but the ctan collection amscls-doc is an example of a multi-version document. might be more complicated than you are looking for, but it definitely works, giving quite different outputs for four major user guides from a "single" base. (some "helper" files are needed where the requirements are significantly different.) – barbara beeton Jul 5 '18 at 19:56
1

In the commenting of your question/in other answers usage of the comment package is already suggested.

Using the docstrip package might be a different, non-environment-based approach to the matter.

The docstrip package is a means for deriving different .tex-input-files from one (set of) master file(s). Within the master file(s) you can place so-called tags. These tags are used for determining those derived files where the tagged portions of text from the master file(s) will be copied to.

Both within the head of the master file and in another file you can have so-called \generate-directives for creating those files that are to be derived from the master file(s).

More info about the docstrip package can be found at CTAN.

If you save the following example as a file with a name both other than teacher.tex and other than students.tex and compile it with tex or pdftex or latex or pdflatex, two new files will be created, one of them is called teacher.tex, the other one is called students.tex.

%<*ignore>
% Section with docstrip directives for generating different 
% .tex-input-files:
\input docstrip

\declarepreamble\teachers
____________________________

Course Guide, release only for teachers, with teaching notes embedded.

Use pdflatex/pdftexify for compiling this file.

\endpreamble

\declarepreamble\students
____________________________

Course Guide, release for students, no teaching notes embedded.

Use pdflatex/pdftexify for compiling this file.

\endpreamble

\generate{%
  \nopostamble
%
  \usepreamble\teachers
  \file{teacher.tex}{\from{\jobname.tex}{teacher}}%
%
  \usepreamble\students
  \file{students.tex}{\from{\jobname.tex}{students}}%
}%
% Here you can probably insert \write18-calls suitable for your platform
% for calling pdflatex from console for compiling the files
% just generated -- something like:
%    \immediate\write18{pdflatex teacher.tex}
%    \immediate\write18{pdflatex students.tex}
%    \immediate\write18{pdftexify teacher.tex}
%    \immediate\write18{pdftexify students.tex}
%
\csname stop\endcsname % <- end this TeX-run in case you used (pdf)LaTeX
                       %    for generating the files.
%
\bye % <- end this TeX-run in case you used (pdf)TeX for generating the 
%    %    files.
%
%</ignore>
% Section containing the actual LaTeX document, with tags for
% generating different variants with different target groups
%<*teacher,students>
\documentclass{article}
\begin{document}
This is both for students and for teachers.
%<*teacher>
This is for teachers only.
%</teacher>
%<*students>
This is for students only.
%</students>
This is both for students and for teachers also.
\end{document}
%</teacher,students>

The content of teacher.tex will be:

%%
%% This is file `teacher.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% test.tex  (with options: `teacher')
%% ____________________________
%% 
%% Course Guide, release only for teachers, with teaching notes embedded.
%% 
%% Use pdflatex/pdftexify for compiling this file.
%% 
\documentclass{article}
\begin{document}
This is both for students and for teachers.
This is for teachers only.
This is both for students and for teachers also.
\end{document}

The content of students.tex will be:

%%
%% This is file `students.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% test.tex  (with options: `students')
%% ____________________________
%% 
%% Course Guide, release for students, no teaching notes embedded.
%% 
%% Use pdflatex/pdftexify for compiling this file.
%% 
\documentclass{article}
\begin{document}
This is both for students and for teachers.
This is for students only.
This is both for students and for teachers also.
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.