Monthly Archive: May 2008

LaTeX presentation and a couple of my .sty files

I did an Introduction to LaTeX for Linguistics at McGill today.

If you want to see the files that went into making it, you can download all of the presentation files. It is a beamer presentation.

Note: There was a problem with the display of the example of example numbering in the original version. Those who were present, and those who have a physical handout, know what I mean. It has been fixed here. Although I am not completely sure what the root cause of the problem was, changing the order of the includepackage commands in the preamble made everything work out.

In case it is interesting, I’ll also post my phtools.sty file, which is basically a package I wrote myself that just includes the other packages I usually use (in an appropriate order) and defines some common convenience macros I use. In there, I also refer to my syntaxarrows.sty file, which I wrote to help out when drawing arrows over a line of text. Both of those are just for informational purposes, you can think of them as unsupported alpha versions.

More TextMate LaTeX language editing

When starting off with LaTeX, I defined the following convenience command in the all-purpose package I load with everything.

  \newcommand{\mot}[1]{\emph{#1}}

The idea is that inline linguistic examples would be marked with mot rather than \emph or \textit. Why? Well, they’re not emphatic. And just forcing the typeface seemed clunky. So, I decided that my markup should reflect the semantics. However, of course, in reality, the definition simply defines these as emphatic, but I could in principle change this later.

However, I can differentiate these things in my source files with the help of a small addition to the language definition in the LaTeX bundle (see also the previous post).

I just added this:

		{	name = 'meta.function.mot.latex';
			contentName = 'string.quoted.mot.latex';
			comment = 'Added by Paul Hagstrom';
			begin = '((\)mot)(\{)';
			end = '\}';
			beginCaptures = {
				1 = { name = 'support.function.mot.latex'; };
				2 = { name = 'punctuation.definition.function.latex'; };
				3 = { name = 'punctuation.definition.mot.begin.latex'; };
			};
			endCaptures = { 0 = { name = 'punctuation.definition.mot.end.latex'; }; };
			patterns = ( { include = '$base'; } );
		},

and, now, my \mot{}s are colored like a quoted string, which is really much more like what they are.

This is just a copy of the \emph rule, but with the name set to reflect a quoted string rather than italicized markup.

Nice to have a post-hoc benefit to that initial semantic decision.

Adding a little bit to TextMate’s LaTeX bundle

I make use of the citation commands lifted from the style sheet from Semantics & Pragmatics, which defines some useful macros like \posscitet and \pgcitet. But TextMate’s LaTeX bundle, of course, doesn’t know about them.

I can’t claim to understand what I did, but if you go to the Bundle editor, turn down the disclosure arrow on the LaTeX bundle, select LaTeX (down the list a ways, with a grey “L” by it, for “language”), you can edit the language rules. I found the area that handles the citation commands and added these new ones.

About 75% of the way down the file, you’ll find the following line:

						(?:foot)?(?:full)?(?:no)?(?:short)?		# Function Name

I changed it to this:

						(?:foot)?(?:full)?(?:no)?(?:short)?(?:poss)?(?:pg)?		# Function Name

And now it seems to be picking up my \posscitet commands as well.