These option clashes happen when a package is requested to be loaded on two different positions, like by you and inside another package, but with different options. The package is loaded by the first \usepackage
(or its twin \RequirePackage
); it isn't loaded again when it is requested again. It simply can't be loaded a second time. Therefore the new options can be activated and previous options might conflict with the second usage. So LaTeX creates an error to report this issue to you.
The way to fix this is to declare the options beforehand using \PassOptionsToPackage{<options>}{<package>}
. Then they are used wherever the package is loaded.
\documentclass{article}
\usepackage{ifpdf}
\ifpdf
\PassOptionsToPackage{pdftex,usenames,dvipsnames}{color}
\usepackage[T1]{fontenc}
\usepackage{libertine} % most likely loads 'color' itself
%\usepackage{lmodern} % doesn't load 'color'
\usepackage{color}
\usepackage[pdftex]{graphicx}
\else
%\bye
\fi
\begin{document}
Hello, world!
\end{document}
I can't test it by myself, because I don't have the libertine
package installed.
PS:
I don't think you need to set pdftex
manually. Normally packages do a good job recognizing the driver by themselves. Also you might want to use the extended xcolor
package instead of color
.
As Martin said, interactive parts of a PDF, called Annotations in PDF specification parlance, such as links or 3D objects, get lost when embedding a PDF containing them. Instead, Annotations have to be re-generated for the new PDF.
To embed a 3D object in the PRC format into a PDF, use LaTeX package media9
. See media9
manual, section "3D quick-start guide".
In case the standalone PRC file is not available it can be extracted from the PDF. This can be done manually, as explained below, or automatically with the help of a small Perl script. Either method requires a tool for uncompressing PDFs, such as PDFtk.
Extracting the PRC from PDF is not recommended if the PRC was generated by asymptote
and you have the asy
source file of it!
Standalone PRC files are generated from asy
source by
asy --keep --tex pdflatex mysource.asy
Automatically, using PDFtk + Perl script
This extracts all PRC streams from PDFwithPRC.pdf
to separate files prc-0.prc
, prc-1.prc
, ...
pdftk PDFwithPRC.pdf output - uncompress | perl prcextract.pl
On Windows, with a Java runtime and some perl.exe
installed:
java -jar pdftk-all.jar PDFwithPRC.pdf output - uncompress | perl prcextract.pl
Perl script prcextract.pl
:
#!/usr/bin/perl
$prc=0;
$stream=0;
$cnt=0;
while(<>){
if(/^stream/) {$stream=1;}
elsif(/^endstream/) {$stream=0; if($prc){close $PRC;} $prc=0;}
elsif((/^PRC/ || $prc) && $stream) {
if(!$prc){open $PRC,">prc-".$cnt++.".prc";select $PRC} print; $prc=1;
}
}
Manual procedure, by PDFtk + text editor
First uncompress the PDF:
pdftk doc.pdf output doc.unc.pdf uncompress
Open doc.unc.pdf
in a text editor and scroll down to a line that starts with PRC
. This line appears just after a line with the PDF keyword stream
.
Delete everything from begin of the file up to and including the line containing the stream
keyword.
Delete everything beginning with the line starting with the endstream
keyword directly after the PRC stream upto the end of the file.
Save what has left as a file whose name ends in .prc
.
Best Answer
If you highlight and annotate inside a PDF figure with tools such as Acrobat, Preview, or Evince, these elements do not become part of the PDF figure – they are stored as PDF annotations.
Basically, annotations are distinct objects that are put on top of the PDF figure, can be edited, moved around and so on by viewers that support this. They also may look differently in every viewer, as the PDF specifications only defines the annotation types and properties, but not how they are to be rendered on screen.
To have annotations become part of the figure, the PDF need to be "flattened", for instance, by printing it (including annotations) into another PDF file. However, this is not supported by many PDF viewers.