LyXExporting only two pages to PDF

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Exporting only two pages to PDF

Post by insipidtoast »

Hello,

I only want to export two pages of my lyx file. Instead of viewing all 322 pages in pdflatex, I only want to view pages 84 and 236 how do I compile just those two pages?

Thanks
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class

Recommended reading 2024:

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

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: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Exporting only two pages to PDF

Post by Stefan Kottwitz »

You could use the pdfpages package in a short separate document for including just those two pages from the other document.

Stefan
LaTeX.org admin
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Exporting only two pages to PDF

Post by insipidtoast »

I started a new lyx file and entered

Code: Select all

\usepackage{pdfpages}
into the preamble.
Then I entered

Code: Select all

\includepdf[pages={84,200}]{my_document.pdf}
as an ERT and it didn't work. I tried entering the same command in the document preamble, and it still didn't work. I'm guessing I wrote the command wrong.

http://texdoc.net/texmf-dist/doc/latex/ ... fpages.pdf
An example at the bottom of page 2 of this document would be helpful, because it's not very clear how I'm supposed to enter the command.

What did I do wrong?
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Exporting only two pages to PDF

Post by scottkosty »

insipidtoast wrote:I started a new lyx file and entered

Code: Select all

\usepackage{pdfpages}
into the preamble.
Then I entered

Code: Select all

\includepdf[pages={84,200}]{my_document.pdf}
as an ERT and it didn't work. I tried entering the same command in the document preamble, and it still didn't work. I'm guessing I wrote the command wrong.

http://texdoc.net/texmf-dist/doc/latex/ ... fpages.pdf
An example at the bottom of page 2 of this document would be helpful, because it's not very clear how I'm supposed to enter the command.

What did I do wrong?
In LyX, start a new document and go to
Insert > File > External Material.
Then, under "Template", select "PDF Pages" and follow the instructions there.

Note that in LyX it will only show a thumbnail of the first page. The output will be fine though.

Scott
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Exporting only two pages to PDF

Post by insipidtoast »

Scott,

Thanks for your input. Those instructions, however, tell me even less than what the pdfpages pdf tells me.
That's where I need some clarification. If I just want to view pages 84 and 200 as their own pdf document then do I simply type as an ERT:

Code: Select all

pages={84,200}
in the document just before the box for my pdf that I inserted.

In short, where and how do I enter the command?
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Exporting only two pages to PDF

Post by scottkosty »

insipidtoast wrote:Scott,

Thanks for your input. Those instructions, however, tell me even less than what the pdfpages pdf tells me.
That's where I need some clarification. If I just want to view pages 84 and 200 as their own pdf document then do I simply type as an ERT:

Code: Select all

pages={84,200}
in the document just before the box for my pdf that I inserted.

In short, where and how do I enter the command?
See the attached example. It will pick pages 3 and 6 of the attached pdf by entering

Code: Select all

pages={3,6}
in the options field, as the screenshot shows.

Scott
Attachments
screenshot
screenshot
pdfpages_example.png (35.06 KiB) Viewed 22582 times
RJournal_2011-1_Wickham.pdf
(151.86 KiB) Downloaded 378 times
pdfpages_example.20.lyx
(1.34 KiB) Downloaded 518 times
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Re: Exporting only two pages to PDF

Post by insipidtoast »

Wow, thanks a million, Scott. That really worked.

YOu are the best!
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Exporting only two pages to PDF

Post by scottkosty »

Glad it worked.

Note that pdftk is a great tool to have for these situations. I think it is available for Windows but not sure.
insipidtoast
Posts: 128
Joined: Wed Jul 04, 2012 5:34 pm

Re: Exporting only two pages to PDF

Post by insipidtoast »

It's weird, you know the lyx way of doing everything, whereas everyone else on here only knows latex code.
FYI:
I'm using windows with LyX 2.0 and MiKTeX 2.9
I'm designing a book using the Koma-script class
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Exporting only two pages to PDF

Post by scottkosty »

insipidtoast wrote:It's weird, you know the lyx way of doing everything, whereas everyone else on here only knows latex code.
Most advanced LaTeX users do not use LyX. The ones around here are very nice to go out of their way to give LyX-specific solutions. I am not an advanced LaTeX user but I used to like writing LaTeX directly in vim. I personally like using LyX better now because it makes LaTeX accessible to everyone and at the same time provides some advanced features for power-users. It's also extremely extensible, especially if you know C++ and/or Python, but even if you don't.

Scott
Post Reply