General ⇒ Chapters and Importing PDFs
Chapters and Importing PDFs
My second problem is trying to import pages from a data sheet. I'd like latex to place a page from a PDF into the document, without applying any formatting or shrinking it to the boarders, whilst still counting as a page so that the table of contents and page numbering is correct for pages that follow.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Chapters and Importing PDFs
first you can use \addcontentsline:
Code: Select all
\addcontentsline{toc}{chapter}{chapter title}
Stefan
Re: Chapters and Importing PDFs
If, for some reason, the pdfpages package fails, you can still include a specific page of a PDF document through the well known \includegraphics command: write something like \includegraphics[page=n]{file.pdf}, where n is the page number you want. I frequently follow this approach, for example, to include pages of a A5 document in an A4 one. Of course, you can use the remanining parameters of \includegraphics to fine tune of the page inclusion.
Re: Chapters and Importing PDFs
Re: Chapters and Importing PDFs
Chapters and Importing PDFs
Code: Select all
\documentclass[a4paper,12pt]{report}
\usepackage{fullpage} %Forces 1 inch boarders
\usepackage{graphicx,amssymb,amstext,amsmath}
\usepackage{sectsty}
\usepackage{txfonts}
\usepackage{setspace} %see \doublespacing
\usepackage{float} %sub floats
\usepackage{fancyhdr}%Custom headers
\usepackage{listings} %fr ansi c
\usepackage{url} %wrap URLS
\usepackage{appendix}
\usepackage{tocbibind}
\usepackage{pdfpages} %Allows direct insertion of PDFs
%
%-------------------- start of the 'preamble'
%
%
%% homebrew commands -- to save typing
\newcommand\etc{\textsl{etc}}
\newcommand\eg{\textsl{eg.}\ }
\newcommand\etal{\textsl{et al.}}
\newcommand\Quote[1]{\lq\textsl{#1}\r
q}
\newcommand\fr[2]{{\textstyle\frac{#1}{#2}}}
\newcommand\miktex{\textsl{MikTeX}}
\newcommand\comp{\textsl{The Companion}}
\newcommand\nss{\textsl{Not so Short}}
%
%--------------------- end of the 'preamble'
%
\begin{document}
%-----------------------------------------------------------
\title{XXX}
\author{XXX}
\maketitle
%-----------------------------------------------------------
\begin{abstract}\centering
Something here soon \texttrademark .
\end{abstract}
%-----------------------------------------------------------
\tableofcontents
\listoftables
\listoffigures
%-----------------------------------------------------------
\doublespacing %Forces double space with above package
\setcounter{secnumdepth}{5} %allows for more numbered subsections
\renewcommand{\chaptername}{} %Remove word Chapter from chapters
\pagestyle{fancy}
\rhead{} %Remove undesired header elements
\renewcommand{\headrulewidth}{0.5pt}
\makeatletter
\renewcommand*\@makechapterhead[1]{%
{\parindent \z@ \raggedright \normalfont
\huge\bfseries
\ifnum \c@secnumdepth >\m@ne
\thechapter . \space
\fi
#1\par\nobreak
\vskip 20\p@
}}
\makeatother
\renewcommand{\chaptermark}[1]{%
\markboth{\thechapter.\ #1}{}}
\headsep = 25pt
\include{chap1}
\include{chap2}
\include{chap3}
\include{chap4}
%-----------------------------------------------------------
\singlespacing %Forces single space with above package
\bibliographystyle{biostyle}
\bibliography{bibdatabase}
%-----------------------------------------------------------
\appendix
\include{app4}
\include{app1}
\include{app2}
\include{app3}
%-----------------------------------------------------------
\end{document}
Code: Select all
%\chapter{Statement of Work}
\addcontentsline{toc}{chapter}{Statement of Work}
\includepdf[pages=1-2]{sow2.pdf}
%\includegraphics[page=1]{sow2.pdf}
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Chapters and Importing PDFs
do you use latex or pdflatex? If you can include eps files, then it's latex, but that cannot include pdf files. For that you should use pdflatex, that means compiling directly to pdf instead of going the way over dvi and ps.
If that's not clear for you, look at the first line in your .log file: there you should read format=pdflatex, not format=latex.
Stefan
Re: Chapters and Importing PDFs
- Stefan Kottwitz
- Site Admin
- Posts: 10360
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Chapters and Importing PDFs
I recommend to convert those eps files to pdf format using eps2pdf or epstopdf. Then you can include them as pdf files using pdflatex.
Stefan