1

I am using the code below to develop a course syllabus. I tried different approaches without success to add an image at the top right of each document page and simultaneously move the header that appears on the second page to the bottom of the document's pages.

\documentclass[PS,11pt]{syllabus}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{url}
\usepackage[small,compact]{titlesec} 
\usepackage{xcolor}
\usepackage{lipsum}

% Reduce spacing between itemize
\let\tempone\itemize
\let\temptwo\enditemize
\renewenvironment{itemize}{\tempone\addtolength{\itemsep}{-.5\baselineskip}}{\temptwo}

% Roman section numbers
\renewcommand{\thesection}{\Roman{section}} 

\usepackage[pdftex, bookmarksopen=true, bookmarksnumbered=true, 
pdfstartview=FitH, breaklinks=true, urlbordercolor={0 1 1}, citebordercolor={0 1 0}, colorlinks = true]{hyperref}

% To eliminate the newline after \subsubsection
\titleformat{\subsubsection}[runin]{}{}{}{}[]

% Shade within enumerate
\usepackage[framemethod=TikZ]{mdframed}
\newmdenv[backgroundcolor=gray!40,roundcorner=10pt,nobreak=true]{shaded}

% Dot after section number
\titlelabel{\thetitle.\quad}

\textheight 9in
\textwidth 6.5in
\topmargin -.5in
\oddsidemargin 0in
\evensidemargin 0in

\newcommand{\percent}{\ensuremath{\%\;}}


\begin{document}

\title{\textbf{Course Title} \\ 
\vspace{.2cm}
Syllabus}
\name{Professor\\
    \vspace{.2cm}Year}


\businessAddress{\emph{Room}: TBD \\ \emph{Time}: Tuesday/Thursday 
5:00-6:20pm\\
\emph{Prerequisites}: None

}

\homeAddress{
             \emph{Email}: 
             \href{mailto:[email protected]}{\color{gray}{[email protected]}}\\
             \emph{Office Hour}: Thu 11:00am-Noom, sign up 
             \href{TBD}{\color{gray}{online}},\\
\hspace{2.5cm}Room: 
TBD, or by appointment.\\
\textbf{TA}: TBD\\
             \emph{Email}: 
             \href{mailto:tbd}{\color{gray}{tbd}}\\
             \emph{Office Hour}: TBD, Room: TBD \\ 
\hspace{2.5cm}or by appointment. \\
             }


\begin{syllabus}

\textbf{{\Large Overview and Course Goals}}\\

\vspace{-.2cm}

\lipsum[3-5]

\pagebreak

\lipsum[3-5]

\end{syllabus}
\end{document}

Page one

Page two

4
  • 1
    In LaTeX, you generally add headers and footers via the fancyhdr package. Commented Mar 19, 2023 at 5:31
  • 1
    What is your syllabus class? Commented Mar 19, 2023 at 15:41
  • You can add pagestyles the old fashion way using \def\ps@mystyle{...}. See the document class source for esamples. Commented Mar 19, 2023 at 17:26
  • @PietervanOostrum I do not know. I just use the code above to generate the document. Any suggestions on how I can check the syllabus class? Commented Mar 19, 2023 at 17:39

1 Answer 1

0

After several additional tries, I got it! It is probably possible to have a better code, but it does the task.

\documentclass[PS,11pt]{syllabus}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{url}
\usepackage[small,compact]{titlesec} 
\usepackage{xcolor}
\usepackage{lipsum}
\usepackage{fancyhdr} % Added this package
\usepackage{graphicx} % Added this package
\usepackage[margin=1in,
headheight=25pt,                           
]{geometry}

% Reduce spacing between itemize
\let\tempone\itemize
\let\temptwo\enditemize
\renewenvironment{itemize}{\tempone\addtolength{\itemsep}{-.5\baselineskip}}{\temptwo}

% Roman section numbers
\renewcommand{\thesection}{\Roman{section}} 

\usepackage[pdftex, bookmarksopen=true, bookmarksnumbered=true, 
pdfstartview=FitH, breaklinks=true, urlbordercolor={0 1 1}, citebordercolor={0 
    1 0}, colorlinks = true]{hyperref}

% To eliminate the newline after \subsubsection
\titleformat{\subsubsection}[runin]{}{}{}{}[]

% Shade within enumerate
\usepackage[framemethod=TikZ]{mdframed}
\newmdenv[backgroundcolor=gray!40,roundcorner=10pt,nobreak=true]{shaded}

% Dot after section number
\titlelabel{\thetitle.\quad}

\textheight 9in
\textwidth 6.5in
\topmargin -.5in
\oddsidemargin 0in
\evensidemargin 0in

\newcommand{\percent}{\ensuremath{\%\;}}

% Header and Footer configuration
\fancypagestyle{syllabusstyle}{
    \fancyhf{} % Clear all header and footer fields
    \renewcommand{\headrulewidth}{0pt}
    \fancyhead[R]{\includegraphics[height=1cm]{logo_ufpe.png}}
    %%% % Added image to the header
    \fancyfoot[L]{\emph{Professor}}
    \fancyfoot[C]{\emph{Quarter}}
    \fancyfoot[R]{\thepage} % Added page number in the right footer
}
\pagestyle{syllabusstyle}
\fancypagestyle{plain}{
    \fancyhf{} % Clear all header and footer fields
    \renewcommand{\headrulewidth}{0pt}
    \fancyhead[R]{\includegraphics[height=1cm]{logo_ufpe.png}} % 
    %Added image to the header
    \fancyfoot[L]{\emph{Professor}}
    \fancyfoot[C]{\emph{Quarter}}
    \fancyfoot[R]{\thepage} % Added page number in the right footer
}

\fancypagestyle{firststyle}
{
    \fancyhf{}
    \rhead{\raisebox{-2.2\height}{\includegraphics[height=30mm]{logo_ufpe.png}}}
}

\usepackage{graphicx,eso-pic}
% lipsum provides:   \lipsum
% mwe provides:      example-image
% graphicx provides: \includegraphics
% eso-pic provides:  \AddTo..., \AtStockUpperLeft

\newlength\headpicwd
\newlength\headpicht
\setlength{\headpicwd}{10mm}% image width of physical page?
\setlength{\headpicht}{1.7cm}
\newcommand\printpic{%
    \AddToShipoutPictureBG*{%
        \AtStockUpperLeft{%
            \raisebox{-\headpicht}{%
                % centred with respect to physical page ..?
                \hspace*{\dimexpr 0.73\pdfpagewidth - 0.5\headpicwd\relax}%
                \includegraphics[width=\headpicwd, 
                height=\headpicht]{logo_ufpe.png}%
            }%
        }%
    }%
}

\begin{document}
    % print logo
    \printpic
    
    \title{\textbf{Course Title} \\ 
        \vspace{.2cm}
        Syllabus}
    \name{Professor\\
        \vspace{.2cm}Year}
    
    
    \businessAddress{\emph{Room}: TBD \\ \emph{Time}: Tuesday/Thursday 
        5:00-6:20pm\\
        \emph{Prerequisites}: None
    }
    
    \homeAddress{
        \emph{Email}: 
        \href{mailto:[email protected]}{\color{gray}{[email protected]}}\\
        \emph{Office Hour}: Thu 11:00am-Noon, sign up 
        \href{TBD}{\color{gray}{online}},\\
        \hspace{2.5cm}Room:
        TBD, or by appointment.\\
        \textbf{TA}: TBD\\
        \emph{Email}:
        \href{mailto:tbd}{\color{gray}{tbd}}\\
        \emph{Office Hour}: TBD, Room: TBD \\ 
        \hspace{2.5cm} or by appointment. \\
    }
    
    %\thispagestyle{firststyle}
    
    \begin{syllabus}
        
        \textbf{{\Large Overview and Course Goals}}\\
        
        \vspace{-.2cm}
        
        \lipsum[3-5]
        
        \pagebreak
        
        \lipsum[3-5]
        
        \pagebreak
        
        \lipsum[3-5]
        
    \end{syllabus}
\end{document}

enter image description here enter image description here

2
  • Welcome to TeX.SE!
    – Mensch
    Commented Mar 19, 2023 at 18:49
  • You are on the right track. If fancyhdr cannot do it, then it probably requires much more arcane code. Now, there may be some pages where you do not want the image or footer to appear, or wish to change the content. That can also be done with fancyhdr. Its documentation tells you how.
    – user287367
    Commented Apr 19, 2023 at 3:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .