[texhax] getting to a page

Tom Schneider toms at ncifcrf.gov
Sat Apr 26 23:04:33 CEST 2008


I often work at home while ssh linked into a computer at work.  At
work I edit my file with vim and in a separate Terminal/ssh link use
atchange to trigger latex typesetting (see
http://www.ccrnp.ncifcrf.gov/~toms/atchange.html).  The atchange also
puts a copy of the final pdf on the web.  A program on my home
computer, aw, watches the web and grabs the pdf for display on my
screen.  (This is much faster than a remote xwindows display)  This
works quite nicely except that I would like the pdf to come up on the
page I'm working on in vim or at least to stay on the same page.  But
Adobe Reader insists on starting on the first page and I can't
identify any commands to control its start page.  Does anyone know how
to do that?

On the other end, I've succeeded in programming vim to create a file
that gives the line number I'm on when I write the file out.  It goes
in ~/.vim/plugin  This is the code if you are interested:

********************************************************************************
"    version = 1.01 of currentline.vim 2008 Apr 26
" 2008 Apr 26, 1.01: output file is a dot file.
" 2006 Nov 24, 1.00: functional!
"
"  Dr. Thomas D. Schneider
"  National Institutes of Health
"  National Cancer Institute
"  Center for Cancer Research Nanobiology Program
"  Molecular Information Theory Group
"  Frederick, Maryland  21702-1201
"  toms at ncifcrf.gov
"  permanent email: toms at alum.mit.edu (use only if first address fails)
"  http://www.ccrnp.ncifcrf.gov/~toms/

" Capture the current line in the file.

" Method:
" vim book page 321
" 
" "redirect messages to a file
" :redir > filename
" " capture the current line in variable j:
" :let j=line('.')
" " write out the value of j
" :echo j
" :redir END
" 
" simpler:
" 
" :redir > filename
" :echo line('.')
" :redir END

" save in a file named .vimcurrentline
" redir > .vimcurrentline
" echo line('.')
" redir END

" Book page 353: % is current file name
" save in a file named (currentfilename).vimcurrentline
" redir > %.vimcurrentline
" echo line('.')
" redir END

" Book page 355: echon no newline.

function CurrentLine()
" original
"  redir! > %.vimcurrentline
  redir! > .%.vimcurrentline
  echo line('.')
  redir END
:endfunction

********************************************************************************

Given the dot file created by this plugin, I know the current line I'm
on.

To locate that line on the output I considered three methods.

1. convert to ps with dvips, then to pdf with gs.  Back convert from
pdf to text with pdftotext.  For some resaon the result is an empty
file, though back converting pdf to text works with other pdfs.

2. convert to rtf with latex2rtf and then examine the text. 
Unfortunately the RTF doesn't have pages.

3. convert to html with latex2html and then examine the text. 
Unfortunately the html doesn't have pages.

So I've got part of the solution but I'm missing the critical part of
identifying which page of the typeset output I'm on.  If I knew which
page it was I could use gs:

echo "quit" | gs -q -r2000x2000 -sDEVICE=pswrite -sOutputFile=$name%02d.ps $name.p
s

to get all the pages and select just one page for transmission and
display.

Any suggestions would be appreciated.

Tom

  Dr. Thomas D. Schneider
  National Institutes of Health
  National Cancer Institute
  Center for Cancer Research Nanobiology Program
  Molecular Information Theory Group
  Frederick, Maryland  21702-1201
  toms at ncifcrf.gov
  permanent email: toms at alum.mit.edu
  http://www.ccrnp.ncifcrf.gov/~toms/


More information about the texhax mailing list