<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4852305575167169274</id><updated>2011-04-21T13:04:31.945-07:00</updated><category term='LaTeX'/><title type='text'>inf-sup</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://inf-sup.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://inf-sup.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ritesh</name><uri>http://www.blogger.com/profile/08509318595443589955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4852305575167169274.post-7769748986114416736</id><published>2009-02-02T14:23:00.000-08:00</published><updated>2009-02-03T21:54:32.982-08:00</updated><title type='text'>Extract and merge pages from PDF document</title><content type='html'>&lt;p&gt;
I had taken great care in typesetting my thesis. Informative running
headers (current chapter/ section name that shows up on the top of the
page), correct margins when typesetting one-sided or two-sided and other
fine points. 
&lt;/p&gt;
&lt;p&gt;
The LaTeX class file that I wrote for my thesis is based on the book
class and typesets  page numbers at the top outer side.  In keeping
with typographical conventions, and also because it looks nicer, the
first page of the major sectioning unit, chapter or part is handled
differently, namely, the page number at the bottom center.
&lt;/p&gt;
&lt;p&gt;
Now grad studies insists that the page numbers be typeset uniformally
throughout the thesis: either all at the top and all at the bottom.  It
was not that hard to change the LaTeX class to have it put all the page
numbers at the top outer side. But I had already printed my thesis on
bond paper, and there was no point in incurring the expenditure again.
 So all I needed was to extract the chapter and part pages from the
"corrected" PDF file, print them and replace the faulty ones in the
print. Hence the need to extract and merge pages from a PDF file.
&lt;/p&gt;
&lt;p&gt;
Well, ghostscript (gs) is our friend and will do the job nicely. In a
nutshell, the following command  will extract pages into individual
files:     
&lt;/p&gt;
&lt;pre&gt;
 gs -dBATCH -dNOPAUSE -dFirstPage=&amp;lt;first_page&amp;gt; -dLastPage=&amp;lt;last_page&amp;gt; -sDEVICE=pdfwrite -sOutputFile=&amp;lt;output_file&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
while the following will merge multiple pdf files in the space delimited list &lt;code&gt;&amp;lt;input_files&amp;gt;&lt;/code&gt; into one
&lt;/p&gt;
&lt;pre&gt;
 gs  -dBATCH -dNOPAUSE  -sDEVICE=pdfwrite -sOutputFile=&amp;lt;output_file&amp;gt; &amp;lt;input_files&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;
Here's the shell script that I used to extract the chapter pages and merge into one PDF file
&lt;/p&gt;
&lt;pre&gt;
 #!/bin/bash

 declare -rx SCRIPT=${0##*/}
 declare -i extract_flag=0
 declare -i merge_flag=0

 declare -a p_num_all=( \
 1 6 7 11 21 33 42 44   \
 54 55 61 73 87 95 109 111 \
 118 119 125 138 147 163 165  \
 170 172    \
 )

 declare -i num_pages=${#p_num_all[*]}
 declare -i offset=12
 declare i
 declare f_name f_name_all
 declare out_file=chapter_pages.pdf

 case $1 in
 0) extract_flag=1
    ;;
 1) merge_flag=1
    ;;
 2) extract_flag=1
    merge_flag=1
    ;;
 *) printf "usage: $SCRIPT  &amp;lt;0|1|2&amp;gt;  &amp;lt;input_file&amp;gt; \n"
    ;;
 esac


 for (( i=1; i&amp;lt;=num_pages; i++ )) ; do   

     p_num=${p_num_all[i-1]}
     p_num_off=$(expr $p_num + $offset)   
    
     f_name="pp-$p_num.pdf"
     f_name_all="$f_name_all $f_name"

     if [ $extract_flag -eq 1 ] ; then
     printf "extracting page %d to file %s \n" $p_num $f_name
     gs  -dBATCH -dNOPAUSE       \
     -dFirstPage=$p_num_off -dLastPage=$p_num_off   \
     -sDEVICE=pdfwrite -sOutputFile=$f_name  \
     $2
     fi
 done
    

 if [ $merge_flag -eq 1 ] ; then
     gs  -dBATCH -dNOPAUSE      \
     -sDEVICE=pdfwrite -sOutputFile=$out_file \
     $f_name_all
 fi
&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;

&lt;!-- html code generated by txt2tags 2.5 (http://txt2tags.sf.net) --&gt;
&lt;!-- cmdline: txt2tags /home/ritesh/Blogger/extract_pdf.t2t --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4852305575167169274-7769748986114416736?l=inf-sup.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://inf-sup.blogspot.com/feeds/7769748986114416736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4852305575167169274&amp;postID=7769748986114416736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/7769748986114416736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/7769748986114416736'/><link rel='alternate' type='text/html' href='http://inf-sup.blogspot.com/2009/02/extract-and-merge-pages-from-pdf.html' title='Extract and merge pages from PDF document'/><author><name>ritesh</name><uri>http://www.blogger.com/profile/08509318595443589955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4852305575167169274.post-7897684025291618552</id><published>2008-07-27T05:18:00.000-07:00</published><updated>2008-08-04T23:25:52.946-07:00</updated><title type='text'>Linux mount ntfs hfsplus partition</title><content type='html'>okay, this pretty much drove me crazy today.
Here are some entries from /dev/disk/by-label

&lt;span style="font-family: arial;"&gt;lrwxrwxrwx 1 root root 10 Aug  4 03:07 Neumann -&gt; ../../sdb5&lt;/span&gt;
&lt;span style="font-family: arial;"&gt;lrwxrwxrwx 1 root root 10 Aug  4 03:07 Newton -&gt; ../../sdb1&lt;/span&gt;
&lt;span style="font-family: arial;"&gt;lrwxrwxrwx 1 root root 10 Aug  4 03:07 opt -&gt; ../../sda6&lt;/span&gt;
&lt;span style="font-family: arial;"&gt;lrwxrwxrwx 1 root root 10 Aug  4 03:07 root -&gt; ../../sda2&lt;/span&gt;

&lt;span style="font-family: arial;"&gt;&lt;/span&gt;the respective file-systems  and mount-points are (from /etc/fstab)

LABEL=root                      /                       ext3            defaults                1 1
LABEL=opt                       /opt                    ext3            defaults                1 2
/dev/disk/by-label/Newton       /Newton                 ntfs                     ro,umask=0222           0 0
/dev/disk/by-label/Neumann      /Neumann                hfsplus         defaults                1 2
#LABEL=Newton       /Newton                 ntfs                     ro,umask=0222           0 0
#LABEL=Neumann      /Neumann                hfsplus         defaults                1 2

See the last two commented out entries starting with LABEL=Newton, and LABEL=Neumann?   So now the million-dollar question is why is it that I'm able to mount the ext3 partitions / and /opt using their labels, while I've to use an explicit device path  for the ntfs and hfsplus partitions (volums)? Mind you, the ntfs and hfsplus  volumes do have labels,  Newton, and Neumann, respectively. I put them there using gparted. Also the corresponding links are very much there in /dev/disk/by-label.  I have a hunch that somebody somewhere is not able to read the  ntfs/hfsplus labels, which are written on the partition itself (another guess) maybe in the first few sectors of the partiton, like the MBR.

Meanwhile, if you are looking to mount your ntfs/hfsplus volumes and using labels, hopefully my experience will save you some time and frustration.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4852305575167169274-7897684025291618552?l=inf-sup.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://inf-sup.blogspot.com/feeds/7897684025291618552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4852305575167169274&amp;postID=7897684025291618552' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/7897684025291618552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/7897684025291618552'/><link rel='alternate' type='text/html' href='http://inf-sup.blogspot.com/2008/07/linux-mount-ntfs-hfsplus-partition.html' title='Linux mount ntfs hfsplus partition'/><author><name>ritesh</name><uri>http://www.blogger.com/profile/08509318595443589955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4852305575167169274.post-1219430211703069367</id><published>2008-05-09T18:57:00.000-07:00</published><updated>2008-05-09T19:14:46.262-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LaTeX'/><title type='text'></title><content type='html'>In TeX Command List -&gt; LaTeX, changed 
&lt;span style="font-family: courier new,monospace;"&gt;%`%l%(mode)%`%t&lt;/span&gt;
to
 &lt;span style="font-family: courier new,monospace;"&gt;%`%l%(mode)%t. &lt;span style="font-family:arial,sans-serif;"&gt;
The new command gets rid of the "\input" in the command line, and now works with
a pre-compiled preamble. The file to be processed still appears as main.tex on the command line (&lt;span style="font-style: italic;"&gt;via&lt;/span&gt; &lt;span style="font-family: courier new;"&gt;%t&lt;/span&gt;) &lt;span style="font-style: italic;"&gt;&lt;span style="font-family: verdana;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: georgia;"&gt;Should&lt;/span&gt;&lt;span style="font-style: italic; font-family: georgia;"&gt;&lt;/span&gt;&lt;span style="font-family: georgia;"&gt; get &lt;span style="font-family: georgia;"&gt;rid of the .tex extension.&lt;/span&gt; &lt;/span&gt;&lt;span style="font-family: verdana;"&gt; &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4852305575167169274-1219430211703069367?l=inf-sup.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://inf-sup.blogspot.com/feeds/1219430211703069367/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4852305575167169274&amp;postID=1219430211703069367' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/1219430211703069367'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/1219430211703069367'/><link rel='alternate' type='text/html' href='http://inf-sup.blogspot.com/2008/05/in-tex-command-list-latex-changed.html' title=''/><author><name>ritesh</name><uri>http://www.blogger.com/profile/08509318595443589955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4852305575167169274.post-2441080591173072890</id><published>2008-05-07T21:46:00.000-07:00</published><updated>2008-05-08T04:39:18.077-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LaTeX'/><title type='text'>Generating LeTeX preamble format (.fmt) file</title><content type='html'>I used to use a compiled preamble, but since i really didn't see a difference in the processing times, perhaps because my dynamic part in my documents is usually quite big, and also because i now have a quad-core machine (gasp!). Anyhow, so i stopped compiling, and over time, forgot the way to generate the .fmt file.

Lately, have been doing some TeX-ing on my laptop, which obviously lacks the desktop's muscle,  hence the need for a pre-compiled preamble. Searching on the net brought me to the blog [1], which gives a pretty good description of the process.

First, some remarks about the command below, looking at which today, sort of  connected together bits of knowledge i have about the inner workings of the TeX system. Also somewhat explains the various options in the command, which even to a seasoned LaTeX user would seem obscure.

&lt;span style="font-family:courier new;"&gt;latex -ini  "&amp;amp;latex preamble.tex \dump"

&lt;span style="font-family:arial;"&gt;s&lt;span style="font-family:georgia;"&gt;o now, LaTeX (and it's other avatars), in my  understanding, is just a front end; in that it provides a number of macros to TeX, which is the real typesetting engine. The macros are (pre-)compiled  and stored in a format file, which in the case of LaTeX would be latex.fmt. So,  ``&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&amp;amp;latex"&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:georgia;"&gt;  in the command above, simply states that latex.fmt be loaded. &lt;/span&gt;

&lt;span style="font-family:georgia;"&gt;Now, let's look using the compiled preamble while compiling the actual document main.tex. The first line of main.tex is:&lt;/span&gt;
&lt;/span&gt;&lt;code&gt;&lt;span style="font-family:courier new;"&gt;
%&amp;amp;preamble&lt;/span&gt;&lt;/code&gt;
&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;
&lt;span style="font-family:georgia;"&gt;well, other than the comment symbol ``%", we've figured out what's going on: &lt;/span&gt;&lt;span style="font-family:georgia;"&gt;the ``&amp;amp;" operator tells TeX to load the (binary ) format file preamble.fmt&lt;/span&gt;

&lt;span style="font-family:georgia;"&gt;As I see on my Powerbook G4, the time saved in the compile cycle is significant when the compiled preamble is used.&lt;/span&gt;


References:
&lt;/span&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;http://magic.aladdin.cs.cmu.edu/2007/11/02/precompiled-preamble-for-latex&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;TeX info manual: memory dump
&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:arial;"&gt;LaTeX info manual&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4852305575167169274-2441080591173072890?l=inf-sup.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://inf-sup.blogspot.com/feeds/2441080591173072890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4852305575167169274&amp;postID=2441080591173072890' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/2441080591173072890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4852305575167169274/posts/default/2441080591173072890'/><link rel='alternate' type='text/html' href='http://inf-sup.blogspot.com/2008/05/generating-letex-preamble-format-fmt.html' title='Generating LeTeX preamble format (.fmt) file'/><author><name>ritesh</name><uri>http://www.blogger.com/profile/08509318595443589955</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
