Introduction
LaTeX has long been my main typesetting environment. This post has some handy dandy codes that I daily use.
Embedding a PDF File within
The following command
is used in the document
environment and embeds the specified PDF
file.
\portitem
{} % title
{./path-to/file.pdf} % file name
{n} % n = page number + 1
To achieve a clean layout, remove headers and footers in file.pdf
. Typically, outer PDF
will carry out its headers and footers. This approach also provides a seamless integration.
Command in preamble:
\newcommand{\portitem}[3]{
\phantomsection \addcontentsline{toc}{section}{#1} % toc entry
\rhead{\textsc{#1}}
\setcounter{pg}{1}
\whiledo{\value{pg}<#3}{ % page number +1
\includepdf[pages=\thepg,scale=1,pagecommand={\pagestyle{fancy}}]{#2} % file name
\addtocounter{pg}{1}
}
}
Package dependencies in preamble:
\usepackage{pdfpages}
\usepackage{ifthen}
\newcounter{pg}
Stamping Unique IDs
Often I print out documents with multiple copies. When it comes to exams, usually I scan the documents and do my grading electronically. Having unique IDs on every copy printed provides better file handling in this process.