[OS X TeX] Custom TexShop tags?

Danny Baillie dbaillie at physics.otago.ac.nz
Mon Mar 2 21:51:08 CET 2009


On 3/03/2009, at 2:59 AM, Themis Matsoukas wrote:

> TS recognizes \chapter, \section etc and produces book mark tags. Is  
> it possible  for the user to define additional tags? I would like to  
> include \frametitle as a custom tag.
>
> Themis

Hi Themis,

You can do it very easily in the source code, one of the beauties of  
open source and a tribute to Richard's easy to read code. You may not  
want to do this (for various reasons, including needing to redo it  
when there is a TeXShop version update), but I have been doing this  
for weeks and it works perfectly for me. The following is probably  
teaching you to suck eggs, but someone who is even more of a noob than  
me may find it useful. First you need to download the source (click  
near the top of http://www.uoregon.edu/~koch/texshop/) then open  
TeXShop.xcodeproj (you need to have installed xcode from your OS X  
disks). Choose the menu Project, "Set Active Build Configuration" to  
"Release" (so that sparkle knows you have v2.25). Then in  
TSAppDelegate.m, add any required items to the ConTeXtTagsKey false  
section (since I use latex, not ConTeXt, currently lines 172 to 186).  
You need to add the TeX commands to the list g_taggedTeXSections and  
the text you want to appear in the list g_taggedTagSections. I've been  
using it with added bibliography and appendix tags, but I've checked  
it with frametitle just now and it works fine. I put the APPENDIX in  
all caps so that I can easily see which chapters are in the appendices.

The main reason I've been doing this, though, is so that I get an  
indented menu. I've put an extra few spaces for the section, more for  
the subsection etc as follows:

		g_taggedTagSections = [[NSArray alloc] initWithObjects:@"chapter: ",
					@"bibliography: ",
					@"APPENDIX: ",
					@"    section: ",
					@"        subsection: ",
					@"            subsubsection: ",
					nil];

This saves me a lot of time every day: I can easily visually scan down  
the chapters and then the sections etc to find what I'm looking for  
(probably only worthwhile if you have more than a screenful on the  
tags menu). It will be obsolete when there are hierarchical menus (in  
TSDocument.m there is a note "Hierarchical menus would be cool...", so  
no point putting in a feature request since it's already on a to do  
list somewhere) but in the mean time it works well for me. As an  
aside, I also put the line numbers in the menu beside the tags so that  
I can navigate easily. In TSDocument.m, find the line (currently 2323):

			titleString = [tag stringByAppendingString: titleString];

and put the following line after

			titleString = [[NSString stringWithFormat:@"%5u ",lineNumber]  
stringByAppendingString: titleString];

A better approach would be to put the tag for the current  
subsubsection in bold, but this may require the menu to be built when  
it is selected rather than when the tag is created (which is the way  
it is set up now). Line numbers are still useful, e.g. for selecting  
an entire section to move it, but Herb's keybindings (at  <http://homepage.mac.com/herbs2 
 >) are probably better for that.

When you're done, build, then get the app from the build/release  
directory and put it where you app normally goes.

Danny

-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: http://email.esm.psu.edu/mac-tex/
List Archive: http://tug.org/pipermail/macostex-archives/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: http://email.esm.psu.edu/mailman/listinfo/macosx-tex



More information about the macostex-archives mailing list