Generalimport pdfs + page size

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jmmmp
Posts: 6
Joined: Sun Oct 19, 2008 5:35 pm

import pdfs + page size

Post by jmmmp »

Hi,

I'm trying to import a pdf into a document, but it isn't working. I'm following Talbot's tutorial http://theoval.cmp.uea.ac.uk/~nlct/latex/novices/, but when I replaced the ps file for a pdf, it stopped being included.
Another funny behavior is that I get different results if I use miktex, winedt (both in xp), or latex in ubuntu. Is this supposed to be normal??

Another thing: this is a build-up to prepare a document composed only of imported pdfs in a special format. How do I proceed to change the page size to 297x466mm portrait, with margins of 0 L+R, and 7mm U+D?

Thanks,

João Pais
Attachments
graphic.tex
(210 Bytes) Downloaded 341 times
shapes.pdf
(12.09 KiB) Downloaded 327 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

import pdfs + page size

Post by Juanjo »

jmmmp wrote:Hi,
I'm trying to import a pdf into a document, but it isn't working. I'm following Talbot's tutorial http://theoval.cmp.uea.ac.uk/~nlct/latex/novices/, but when I replaced the ps file for a pdf, it stopped being included.
If you compile in exactly the same way, it is logical. You should compile with pdfLaTeX instead of LaTeX. For example, in TeXnicCenter, choose the LaTeX=>PDF profile.
jmmmp wrote: Another funny behavior is that I get different results if I use miktex, winedt (both in xp), or latex in ubuntu. Is this supposed to be normal??
You should obtain the same result. Perhaps if you detail what you do in each plaform, we can explain the supposedly different results.
jmmmp wrote: Another thing: this is a build-up to prepare a document composed only of imported pdfs in a special format. How do I proceed to change the page size to 297x466mm portrait, with margins of 0 L+R, and 7mm U+D?
Add this to the preamble:

Code: Select all

\usepackage[papersize={297mm,466mm},hmargin=0cm,vmargin=7mm]{geometry}
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
jmmmp
Posts: 6
Joined: Sun Oct 19, 2008 5:35 pm

Re: import pdfs + page size

Post by jmmmp »

Hi,

thanks for your reply. I didn't install TeXnicCenter, but instead compiled with pdflatex. Is that the same? About the different plattforms, I really did the same on all: opened the document, and texed it. I'll do it again with pdflatex, and see what happens.

Your package worked well for the paper size, but not for the margins. The imported pdfs are just on the edge of the sheet. Am I putting something wrong? I also tried changing the parameters, but the result was the same (or it didn't compiled at all). You can look at graphic1+graphic9 for this.

If I may, there is also another question: the document I'm doing is a mixture of several pdf pages from other documents, either 3 or 6 per page. For that I found out about \includepdfmerge[nup=1x3]{} and \includepdfmerge[nup=1x6]{}, which seem to do the job. But not completely: the displayed pages are correct, but the size isn't the same. Comparing both with graphic-original (with the original size), graphic1's pages are too big, and graphic9 too small. Also, the distribution in the page doesn't really match, as they are a bit too separated.
Do you know if the size of the imported pdfs can be set by any paramter? In the pdfpages manual I couldn't find it. I'm assuming that when the import sizes are corrected, the position on the page will be as well, right? If not, the only solution would be to move the images around?

Thanks,

João
Attachments
graphic-original.zip
(168.13 KiB) Downloaded 216 times
graphic9.zip
(193.96 KiB) Downloaded 223 times
graphic1.pdf
(144.22 KiB) Downloaded 327 times
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

import pdfs + page size

Post by Juanjo »

jmmmp wrote:I didn't install TeXnicCenter, but instead compiled with pdflatex. Is that the same? About the different plattforms, I really did the same on all: opened the document, and texed it.
MikTeX is the TeX system, that is, a set of programs and companion files for typesetting. Winedt and TeXnicCenter are GUIs to that system, since they allow to edit the source files and launch (many of) the programs included in MikTeX. In Ubuntu, the roles of MikTeX and Winedt are played by TeX Live and Kile. pdftex is the main program in every TeX system, which does the real production of documents from the source files (those with tex suffix).
jmmmp wrote: Your package worked well for the paper size, but not for the margins. The imported pdfs are just on the edge of the sheet. Am I putting something wrong? I also tried changing the parameters, but the result was the same (or it didn't compiled at all). You can look at graphic1+graphic9 for this.
Well, you said litterally "with margins of 0 L+R, and 7mm U+D" and that's what the settings of the geometry package does: 0mm on left and right and 7mm up and down. Perhaps I misunderstood something. Anyway, you can fix the margins by varying the values of hmargin and vmargin.
jmmmp wrote: If I may, there is also another question: the document I'm doing is a mixture of several pdf pages from other documents, either 3 or 6 per page. For that I found out about \includepdfmerge[nup=1x3]{} and \includepdfmerge[nup=1x6]{}, which seem to do the job. But not completely: the displayed pages are correct, but the size isn't the same. Comparing both with graphic-original (with the original size), graphic1's pages are too big, and graphic9 too small. Also, the distribution in the page doesn't really match, as they are a bit too separated.
Do you know if the size of the imported pdfs can be set by any paramter? In the pdfpages manual I couldn't find it. I'm assuming that when the import sizes are corrected, the position on the page will be as well, right? If not, the only solution would be to move the images around?
I haven't an answer in this moment. Is it possible that you attach all the pdf files needed for composing each kind of page? Perhaps I can help if I can play with the files and search a solution. It would be convenient that you describe more precisely the result you expect to obtain.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
jmmmp
Posts: 6
Joined: Sun Oct 19, 2008 5:35 pm

Re: import pdfs + page size

Post by jmmmp »

"Well, you said litterally "with margins of 0 L+R, and 7mm U+D" and that's what the settings of the geometry package does: 0mm on left and right and 7mm up and down. Perhaps I misunderstood something. Anyway, you can fix the margins by varying the values of hmargin and vmargin."

And I literally mean 0 / 7 mm. But the margin above was 0, that is, on the edge. I think I tried inverting the values, but the result was the same. Then I wrote 1.7cm to try out, and the result was still the same as before, 0 margin. maybe includepdfmerge overrides the page settings?

"I haven't an answer in this moment. Is it possible that you attach all the pdf files needed for composing each kind of page? Perhaps I can help if I can play with the files and search a solution. It would be convenient that you describe more precisely the result you expect to obtain."

Ok, here are some more files. I think I explained already the general principle: each page has either 3 or 6 imported pdfs over each other, which end up taking the whole page. That we got running. What is now happening is that includepdfmerge is scaling the original pdfs differently (all pdfs have the same width), as well as putting some extra space between them, that is, not putting them just exactly over another.
"graphic-original.pdf" was the 1st page as it should look like (3 groups), and "graphic-original#9.pdf" is the 9th page (the 1st page with 6 groups). These files have the correct layout. [in case you want to know: they were created by exporting the original material as tif, and put together in word. but for some reason word adds sometimes small borders to the images when printed to pdf - but not when printing]

The files pp1-3groups and pp9-6groups have the original pdfs for pages 1 (3 groups) and 9 (6 groups). Is that clear this way?
graphic-original#9.pdf was too big to post here, you can find it in http://www.adrive.com/public/47652857c3 ... 75fd5.html. Here is also a new graphic.tex file, with the new pdf filenames.

Joao
Attachments
graphic.tex
(1.03 KiB) Downloaded 302 times
pp 9-6 groups.zip
(196.62 KiB) Downloaded 206 times
pp1-3 groups.zip
(81.84 KiB) Downloaded 211 times
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

import pdfs + page size

Post by Juanjo »

jmmmp wrote: And I literally mean 0 / 7 mm. But the margin above was 0, that is, on the edge. I think I tried inverting the values, but the result was the same. Then I wrote 1.7cm to try out, and the result was still the same as before, 0 margin. maybe includepdfmerge overrides the page settings?
Yes, it seems that that's what happens.

Your new explanations have given me some hints. I've tried a slightly different approach, based on a direct use of the\includegraphics command (internally, it is also used by \includepdf). So I have more control on the position and size of every pdf. Please, put all the pdf in the same folder and compile the following code:

Code: Select all

\documentclass[11pt]{report}

\usepackage[papersize={297mm,466mm},hmargin=0mm,vmargin={7mm,0mm}]{geometry}
\usepackage{graphicx}
\setlength{\parindent}{0pt}

\begin{document}
\includegraphics[width=\textwidth]{ens1-3-1}
\includegraphics[width=\textwidth]{ens2-3-1}
\includegraphics[width=\textwidth]{ens3-3-1}
\newpage
\includegraphics[width=\textwidth]{ens1-w-9}
\includegraphics[width=\textwidth]{ens1-s-9}
\includegraphics[width=\textwidth]{ens2-w-9}
\includegraphics[width=\textwidth]{ens2-s-9}
\includegraphics[width=\textwidth]{ens3-w-9}
\includegraphics[width=\textwidth]{ens3-s-9}
\end{document}
Does this yield a better pdf? Is it correct? If not, which is exactly the problem that still remains?
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
jmmmp
Posts: 6
Joined: Sun Oct 19, 2008 5:35 pm

Re: import pdfs + page size

Post by jmmmp »

thanks a lot, that looks really good, it's exactly that what I needed. only one question (the last, I promise): is it possible for the includegraphics command to take a page from a document, instead of using a whole document? I ask that because there are 9 pdfs for the whole score (150 pages): one with ens1-3, one with ens2-3, etc etc. The files you had were cut, for practical reasons.
I'll look myself into includegraphics, but will have to wait until monday to have a steady internet again.
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

import pdfs + page size

Post by Juanjo »

jmmmp wrote: is it possible for the includegraphics command to take a page from a document, instead of using a whole document?
Yes, it is. If, say, foo.pdf is a document with several pages, you can write commands like:

Code: Select all

\includegraphics[width=\textwidth,page=3]{foo}
which inserts the third page of foo.pdf. Feel free to continue asking questions if you still need help.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
jmmmp
Posts: 6
Joined: Sun Oct 19, 2008 5:35 pm

Re: import pdfs + page size

Post by jmmmp »

thanks again, everything worked. I guess latex isn't that bad, but it can be a torture to get there. I don't know if I'll have to use it again, but I'll keep an eye on it.

in the end I was compiling the file on both xp and ubuntu on the same computer, and actually both outputs were the same (of course, ubuntu was faster).
Post Reply