When I write LaTeX files I run "Typeset & Preview" quite alot, and therefore was annoyed by the fact that I manually have to scroll the preview window to the current line in my TextMate. Hence I customized the "Typeset & Preview" command using TeXniscope's quite useful AppleScript interface. I replaced the line
--- start --- open -a "$V" "$PDF" --- end ---
with
--- start --- open -a "$V" "$PDF" osascript << EOF tell application "TeXniscope" refresh the front document the front document goto line $TM_LINE_NUMBER of source "$TM_FILEPATH" end tell EOF ---- end -----
Perhaps you find that useful.
Thanks Nicholas, indeed this is very useful. I just committed a fix with it. It needed a slight change for the event that TeXniscope is not the previewer. Actually, I just changed it completely to use forward-search instead, for the cases where one uses a master file with includes, and has the TM_LATEX_MASTER. This is the replacement:
if [[ $(tr <<<"$V" '[A-Z]' '[a-z]') == texniscope ]]; then /Applications/TeXniscope.app/Contents/Resources/forward- search.sh "$TM_LINE_NUMBER" "$TM_FILEPATH" "$PDF"; fi open -a "$V" "$PDF"
If you've placed TeXniscope somewhere else, then you need to change the path above. On Jun 23, 2006, at 2:04 PM, Nicolas Schmidt wrote:
When I write LaTeX files I run "Typeset & Preview" quite alot, and therefore was annoyed by the fact that I manually have to scroll the preview window to the current line in my TextMate. Hence I customized the "Typeset & Preview" command using TeXniscope's quite useful AppleScript interface. I replaced the line
--- start --- open -a "$V" "$PDF" --- end ---
with
--- start --- open -a "$V" "$PDF" osascript << EOF tell application "TeXniscope" refresh the front document the front document goto line $TM_LINE_NUMBER of source "$TM_FILEPATH" end tell EOF ---- end -----
Perhaps you find that useful.
Haris
Am 23.06.2006 um 22:31 schrieb Charilaos Skiadas:
Thanks Nicholas, indeed this is very useful. I just committed a fix with it. It needed a slight change for the event that TeXniscope is not the previewer. Actually, I just changed it completely to use forward-search instead, for the cases where one uses a master file with includes, and has the TM_LATEX_MASTER. This is the replacement:
if [[ $(tr <<<"$V" '[A-Z]' '[a-z]') == texniscope ]]; then /Applications/TeXniscope.app/Contents/Resources/forward- search.sh "$TM_LINE_NUMBER" "$TM_FILEPATH" "$PDF"; fi open -a "$V" "$PDF"
If you've placed TeXniscope somewhere else, then you need to change the path above.
Wouldn't it be better to use the TM_TSCOPE variable which the LaTeX bundle help already mentions? Bundles are frequently updated, so editing a hardcoded path in the bundle itself seems not ideal. I for one keep all LaTeX related apps in /Applications/TeX. Something like
"$TM_TSCOPE"/TeXniscope.app/Contents/Resources/forward-search.sh "$TM_LINE_NUMBER" "$TM_FILEPATH" "$PDF";
(I don't quite understand if simply TM_TSCOPE/... would also work. Also the bundle help should probably clarify whether to give the TM_SCOPE path with or without a trailing slash, with or without the app itself etc.)
Christian
On Jul 3, 2006, at 5:08 PM, Christian Bogen wrote:
Wouldn't it be better to use the TM_TSCOPE variable which the LaTeX bundle help already mentions? Bundles are frequently updated, so editing a hardcoded path in the bundle itself seems not ideal. I for one keep all LaTeX related apps in /Applications/TeX. Something like
Good point, I was not aware of this variable. I changed the command to use it.
"$TM_TSCOPE"/TeXniscope.app/Contents/Resources/forward-search.sh "$TM_LINE_NUMBER" "$TM_FILEPATH" "$PDF";
That should actually be: "${TM_TSCOPE:=/Applications}"/TeXniscope.app/Contents/Resources/ forward-search.sh "$TM_LINE_NUMBER" "$TM_FILEPATH" "$PDF";
since not everyone has TM_TSCOPE set ;)
(I don't quite understand if simply TM_TSCOPE/... would also work. Also the bundle help should probably clarify whether to give the TM_SCOPE path with or without a trailing slash, with or without the app itself etc.)
The help says: “If set this variable contains the path to the TeXniscope application. If not set it defaults to /Applications”
I think the path that it defaults to is a very good indicator of what it should be set to.
Christian
Haris
Am 04.07.2006 um 01:02 schrieb Charilaos Skiadas:
The help says: “If set this variable contains the path to the TeXniscope application. If not set it defaults to /Applications”
I think the path that it defaults to is a very good indicator of what it should be set to.
Indeed, good point! ;)