0

This question already has an answer here:

I've been using the same format and setup of a front page in my homework's e.t.c and I've always wanted to just create an template file. (*.cls) I think? I.e. I don't want to see all my packages in the top of my file. In the front page there are some details I need to be able to change as seen in comments in the code.

I hope you understand my question. Thanks.

\documentclass[a4paper,12pt]{article}
% Template info starts
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm,top=2.3cm,bottom=2.3cm,headheight=16pt,headsep=0.2in,heightrounded]{geometry}
\usepackage{palatino,setspace}

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\nouppercase{\course}}
\chead{\nouppercase{\assignment}}
\rhead{\nouppercase{\school}}


\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}


% This I would like to change outside the template.
\newcommand{\student}{My name here}
\newcommand{\school}{My school's name here}
\newcommand{\course}{My course name}
\newcommand{\assignment}{Assignment 4}
\newcommand{\instructor}{My instructor's name}



\begin{document}
\begin{titlepage}
    \begin{center}

        %\includegraphics[scale=0.8]{rulogo.pdf}~\\[3cm]
        \textsc{\LARGE \school}\\[1cm]
        \textsc{\Large \course}\\[1.5cm]

        % Title
        \HRule \\[0.4cm]
        { \huge \bfseries \assignment \\[0.4cm] }
        \HRule \\[1.5cm]

        % Author and supervisor
        \noindent
        \begin{minipage}{0.4\textwidth}
            \begin{flushleft} \large
                \emph{Students:}\\
                \student
            \end{flushleft}
        \end{minipage}%
        \begin{minipage}{0.4\textwidth}
            \begin{flushright} \large
                \emph{Instructor:} \\
                \instructor
            \end{flushright}
        \end{minipage}

        \vfill

        % Bottom of the page
        {\large \today}

    \end{center}
\end{titlepage}
\clearpage
\pagenumbering{arabic}

% % % % % % % % % % %  Template Info ends.

\section{Section 1}

\clearpage
\appendix
\section{Appendix A}


\end{document}

marked as duplicate by Johannes_B, Gonzalo Medina, user13907, Sean Allred, egreg Jul 4 '15 at 23:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • In other words: We should make a .sty or .cls file from your 'template' for you ? ;-) – user31729 Mar 30 '15 at 8:08
  • 1
    Take a look at the discussion here: tex.stackexchange.com/questions/528/style-class-tutorials – roffe Mar 30 '15 at 8:08
  • 1
    You can simply put that stuff in a file template.tex and then in your documents add the line \input{template} – karlkoeller Mar 30 '15 at 8:08
  • The front/titlepage can be wrapped in to a configurable macro of course and kept in the template too, using a keyvalue interface, for example – user31729 Mar 30 '15 at 8:11