Re: need working example of copier to customize pdf output
On 03/02/2012 02:02 AM, Paul Johnson wrote: Oh, heck. I broke the regular export of the one-page at a time PDF when I added my copier for the 4 sheets on one page. Details below, please advise. Sorry, I'm not sure I understand the issue yet. If you export to "PDF (Beamer)", then this will always give you the 2x2 thing, since the copier will always be invoked. If you try to export to just "PDF (pdflatex)", is that when you have a problem? Richard On Mon, Feb 27, 2012 at 2:15 PM, Richard Heck wrote: On 02/27/2012 01:11 PM, Paul Johnson wrote: When this finally seemed to work, I was so happy. However, I see now I've broken the pdf export. The weird thing is that LyX asks me if I want to replace the old pdf version, and I say yes, it still does not get copied. Just now, I worked on lecture notes and exported to PDF(Beamer). I end up with -rw-r--r-- 1 337226 Mar 2 00:57 Regression-MultipleInputs-lecture-2-2x2.pdf -rw-r--r-- 1 56429 Mar 2 00:55 Regression-MultipleInputs-lecture-2.lyx -rw-r--r-- 1543209 Sep 29 12:17 Regression-MultipleInputs-lecture-2.pdf I do get the 4 slides on 1 page output, the one with 2x2 on the end. The lyx file is saved, but last semester's pdf is stuck there. Here's what I'm using now. In .lyx/preferences, I add: \format "pdf5" "pdf" "PDF (Beamer)" "" "evince" "" "document,vector,menu=export" \converter "pdflatex" "pdf5" "pdflatex $$i" "latex=pdflatex" \copier pdf5 "pdfcopier.sh \"$$i\" \"$$o\"" And here's "pdfcopier.sh" #!/bin/bash INFILE="$1"; pdfnup --nup 2x2 --frame true --suffix '2x2' --batch "$INFILE"; Inside LyX, I can Export to PDF(Beamer) and it does export the file with the 2x2 format, and the name is set correctly. . What do you think?
Re: need working example of copier to customize pdf output
Oh, heck. I broke the regular export of the one-page at a time PDF when I added my copier for the 4 sheets on one page. Details below, please advise. On Mon, Feb 27, 2012 at 2:15 PM, Richard Heck wrote: > On 02/27/2012 01:11 PM, Paul Johnson wrote: When this finally seemed to work, I was so happy. However, I see now I've broken the pdf export. The weird thing is that LyX asks me if I want to replace the old pdf version, and I say yes, it still does not get copied. Just now, I worked on lecture notes and exported to PDF(Beamer). I end up with -rw-r--r-- 1 337226 Mar 2 00:57 Regression-MultipleInputs-lecture-2-2x2.pdf -rw-r--r-- 1 56429 Mar 2 00:55 Regression-MultipleInputs-lecture-2.lyx -rw-r--r-- 1543209 Sep 29 12:17 Regression-MultipleInputs-lecture-2.pdf I do get the 4 slides on 1 page output, the one with 2x2 on the end. The lyx file is saved, but last semester's pdf is stuck there. Here's what I'm using now. In .lyx/preferences, I add: \format "pdf5" "pdf" "PDF (Beamer)" "" "evince" "" "document,vector,menu=export" \converter "pdflatex" "pdf5" "pdflatex $$i" "latex=pdflatex" \copier pdf5 "pdfcopier.sh \"$$i\" \"$$o\"" And here's "pdfcopier.sh" #!/bin/bash INFILE="$1"; pdfnup --nup 2x2 --frame true --suffix '2x2' --batch "$INFILE"; Inside LyX, I can Export to PDF(Beamer) and it does export the file with the 2x2 format, and the name is set correctly. . What do you think? -- Paul E. Johnson Professor, Political Science Assoc. Director 1541 Lilac Lane, Room 504 Center for Research Methods University of Kansas University of Kansas http://pj.freefaculty.org http://quant.ku.edu
Re: need working example of copier to customize pdf output
On 02/27/2012 01:11 PM, Paul Johnson wrote: On Sat, Feb 25, 2012 at 3:00 PM, Richard Heck wrote: On 02/25/2012 01:43 PM, Paul Johnson wrote: Copiers are tied to formats, so you will need to create a new format first. Call it "PDF (beamer)", or something of the sort. When you do, you can assign a copier program. The copier will have to be responsible for the actual copying, as well as the conversion you want. Write a little shell script that takes two arguments, the input file and its output location. So something like: #!/bin/bash INFILE="$1"; OUTFILE="$2"; if [ -z "$OUTFILE" ]; then exit 1; fi pdfnup -nup 2x2 --suffix 2x2' --frame true --output "$OUTFILE" --batch "$1"; Save it somewhere in your path, say to /home/you/bin/pdfcopier.sh, make it executable, and then enter pdfcopier.sh "$$i" "$$o" into the copier field for your new format. Richard Thanks, Richard. I think I'm missing a converter line in preferences. Well, I still don't understand how the ordinary work of pdflatex is supposed to get done before my copier gets called. I created the pdfcopier shell script you mention, it is in the path. I run into some trouble configuring preferences in LyX. Can we just talk about what is in preferences itself? The LyX preferences gui is difficult for me. What do I need for "short name". I was guessing something unique like "pdf5". Yes, that's fine. Now you just need to define a pdflatex --> pdf5 converter. This can be done in the UI: Just copy over the information from the existing "LaTeX (pdflatex)" --> "PDF (pdflatex)" converter. Then LyX knows how to produce the pdf5 format, and it should invoke your copier when it is done. Richard
Re: need working example of copier to customize pdf output
On Sat, Feb 25, 2012 at 3:00 PM, Richard Heck wrote: > On 02/25/2012 01:43 PM, Paul Johnson wrote: > Copiers are tied to formats, so you will need to create a new format first. > Call it "PDF (beamer)", or something of the sort. When you do, you can > assign a copier program. The copier will have to be responsible for the > actual copying, as well as the conversion you want. Write a little shell > script that takes two arguments, the input file and its output location. So > something like: > > #!/bin/bash > INFILE="$1"; > OUTFILE="$2"; > if [ -z "$OUTFILE" ]; then exit 1; fi > pdfnup -nup 2x2 --suffix 2x2' --frame true --output "$OUTFILE" --batch "$1"; > > Save it somewhere in your path, say to /home/you/bin/pdfcopier.sh, make it > executable, and then enter > pdfcopier.sh "$$i" "$$o" > into the copier field for your new format. > > Richard > Thanks, Richard. I think I'm missing a converter line in preferences. Well, I still don't understand how the ordinary work of pdflatex is supposed to get done before my copier gets called. I created the pdfcopier shell script you mention, it is in the path. I run into some trouble configuring preferences in LyX. Can we just talk about what is in preferences itself? The LyX preferences gui is difficult for me. What do I need for "short name". I was guessing something unique like "pdf5". # # FORMATS SECTION ## # \format "pdf5" "pdf" "PDF (BEAMER)" "" "evince" "auto" "document,vector,menu=export" # # COPIERS SECTION ## # \copier pdf5 "pdfcopier.sh \"$$i\" \"$$o\"" That fails thusly: $ lyx -e pdf5 hpcexample-1.lyx Error: Couldn't export file No information for exporting the format PDF (BEAMER). PDF (BEAMER) does not show in the LyX export menu. -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas
Re: need working example of copier to customize pdf output
On 02/25/2012 01:43 PM, Paul Johnson wrote: I'm generating a lot of slide shows for my statistics class. Sometimes I forget to run the followup program to create a compressed version of the presentation. It want to make that automatic.[1] When I export a document in pdf from a Beamer slides project, I also want this shell program to run. It automatically creates another pdf document that is 4 slides on one page. #!/bin/bash pdfnup --nup 2x2 --suffix '2x2' --frame true --batch $1 pdfnup is from package called "pdfjam" on Debian Linux. The output is awesome, quick, convenient. I am reading the LyX customization manual about copiers, but I just can't understand it! I don't want to destroy the existing copy behavior that writes the PDF output to the document folder, I just want that additional command to run. But I don't want this 2x2 PDF type for all PDF I create, just for the Beamer slide projects. Copiers are tied to formats, so you will need to create a new format first. Call it "PDF (beamer)", or something of the sort. When you do, you can assign a copier program. The copier will have to be responsible for the actual copying, as well as the conversion you want. Write a little shell script that takes two arguments, the input file and its output location. So something like: #!/bin/bash INFILE="$1"; OUTFILE="$2"; if [ -z "$OUTFILE" ]; then exit 1; fi pdfnup -nup 2x2 --suffix 2x2' --frame true --output "$OUTFILE" --batch "$1"; Save it somewhere in your path, say to /home/you/bin/pdfcopier.sh, make it executable, and then enter pdfcopier.sh "$$i" "$$o" into the copier field for your new format. Richard
Re: need working example of copier to customize pdf output
I'm not sure if a copier or converter can be associated to a particular document class, but this task does not seem to be closely tied to LyX since it is just pdf-to-pdf conversion. I mean you can write a shell script named, say, pdfnup22, and put it in your PATH so that each time you call pdfnup22 to convert all your slides to the 2x2 layout. To restrict the conversion only on certain files, I guess you can name all your slides with a special pattern, e.g. something like ^.*-lecture.pdf$, then pdfnup22 lists all files with this pattern and convert them all. This conversion can be done on demand, instead of each time you export PDF from LyX. Or if you like point-and-click, you can make a pdfnup22.sh in your directory and change its mode to be executable; then each time you want to convert the slides, just click it and you are done. Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Sat, Feb 25, 2012 at 12:43 PM, Paul Johnson wrote: > I'm generating a lot of slide shows for my statistics class. Sometimes > I forget to run the followup program > to create a compressed version of the presentation. It want to make > that automatic.[1] > > When I export a document in pdf from a Beamer slides project, I also > want this shell program to run. > It automatically creates another pdf document that is 4 slides on one page. > > #!/bin/bash > > pdfnup --nup 2x2 --suffix '2x2' --frame true --batch $1 > > > pdfnup is from package called "pdfjam" on Debian Linux. The output is > awesome, quick, convenient. > > > I am reading the LyX customization manual about copiers, but I just > can't understand it! > > I don't want to destroy the existing copy behavior that writes the PDF > output to the document folder, > I just want that additional command to run. But I don't want this 2x2 > PDF type for all PDF I create, > just for the Beamer slide projects. > > Thanks in advance. > > > [1] I've got example output here, in case you want to see what I mean: > > http://pj.freefaculty.org/guides/stat/Regression/ElementaryOLS > > I just upload the full working directory, let the students take the > source code or the pdf output, > or the 2x2 pdf output. > > -- > Paul E. Johnson > Professor, Political Science > 1541 Lilac Lane, Room 504 > University of Kansas
need working example of copier to customize pdf output
I'm generating a lot of slide shows for my statistics class. Sometimes I forget to run the followup program to create a compressed version of the presentation. It want to make that automatic.[1] When I export a document in pdf from a Beamer slides project, I also want this shell program to run. It automatically creates another pdf document that is 4 slides on one page. #!/bin/bash pdfnup --nup 2x2 --suffix '2x2' --frame true --batch $1 pdfnup is from package called "pdfjam" on Debian Linux. The output is awesome, quick, convenient. I am reading the LyX customization manual about copiers, but I just can't understand it! I don't want to destroy the existing copy behavior that writes the PDF output to the document folder, I just want that additional command to run. But I don't want this 2x2 PDF type for all PDF I create, just for the Beamer slide projects. Thanks in advance. [1] I've got example output here, in case you want to see what I mean: http://pj.freefaculty.org/guides/stat/Regression/ElementaryOLS I just upload the full working directory, let the students take the source code or the pdf output, or the 2x2 pdf output. -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas