Preamble for setting up a latex/pdf for homework or writing test.

In summary, the conversation discusses the use of a .tex file for creating exams, including the placement of information and the inclusion of commands and macros. The sample .tex file provided also includes the use of various commands and the creation of a title page for the exam. The conversation also mentions the importance of having the macros file and the code in the same folder path to avoid errors in the compiler.
  • #1
DrWahoo
53
0
I use this when making exams for all my courses. It goes in the preable or the very beginning of the .tex file. Note the use of the commands, I also include commands imported by the file macros! Macros is simiply a .tex file defining your own commands. I have included in another post a list of over 600 simple commands that makes typesetting in latex much easier.

Anyways, here is the start of the .tex file, you put your information below this in the .tex file. Please note, the macros file and the code here(must be contained in the same folder path, otherwise you macros/commands won't load and you will get errors in the compiler.

Code:
\documentclass[12pt]{article}
\usepackage{graphicx}

\addtolength{\textwidth}{1.5in}
\addtolength{\hoffset}{-1.in}
\addtolength{\textheight}{2.0in}
%\addtolength{\voffset}{-1.68in}
\addtolength{\voffset}{-0.8in}
\newcommand {\rreal}{\mbox{$R\!\!\!\!\!l\,\,\,\,$}}
\newcommand{\graphspace}{\vspace{2in}}
\newcommand{\eqnspace}{\hspace{.1in}}
\newcommand{\toppageoneexam}{\vspace{-.4in} \mbox{ } \hspace{-.6in}
\parbox[t]{7.8in} 
{\noindent {\bf Name:} \hspace{.01in}
$\underline{\mbox{\hspace{3.5in}}}$\ \ {\bf Section:} \underline{\hspace{.5in}}  }}
%\newcommand{\toppageexam}{\vspace{-.4in} \parbox[t]{7.5in}
%{\noindent {\bf Name:} \hspace{.01in}
%$\underline{\mbox{\hspace{3.5in}}}$\\ }}
\newcommand{\toppageexam}{\vspace{-.6in}  \hspace{-.6in} 
\parbox[t]{6.5in}
{\noindent {\bf Name:} \hspace{.01in}
$\underline{\mbox{\hspace{3.5in}}}$ \ \ {\bf Section:} \underline{\hspace{.5in}} }}

\include{macros} 

\begin{document}
 
Physics news on Phys.org
  • #2
\begin{center}{\Large \bf Exam Title} \\\vspace{.2in}{\small Instructor's Name} \\{\small Course Name} \\{\small Date}\end{center}\toppageoneexam\graphspace\noindent Here is where your exam starts! \end{document}
 

1. What is a preamble in LaTeX?

A preamble in LaTeX is a set of commands that come before the main body of a document. It is used to define the document class, load packages, and set formatting options.

2. How do I set up a LaTeX document for homework or writing tests?

To set up a LaTeX document for homework or writing tests, you will need to specify the document class as either "article" or "exam" in the preamble. You can also use packages such as "amsmath" and "amssymb" for mathematical symbols and equations.

3. What are the benefits of using LaTeX for homework or writing tests?

LaTeX offers several benefits for homework or writing tests, such as its ability to generate professional-looking documents, its support for mathematical equations and symbols, and its efficient handling of large documents.

4. How do I include images in my LaTeX document for homework or writing tests?

To include images in a LaTeX document, you will need to use the "graphicx" package in the preamble and then use the "\includegraphics" command in the body of the document. Make sure to specify the correct file path for the image.

5. Can I convert a LaTeX document to PDF for easier sharing?

Yes, you can convert a LaTeX document to PDF by using a LaTeX compiler such as TeXstudio or Overleaf. These compilers have an option to export the document as a PDF file.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
Back
Top