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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- 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}\rq}\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}\centeringSomething here soon \texttrademark .\end{abstract}%-----------------------------------------------------------\tableofcontents
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: 10324
- 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: 10324
- 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