# [OS X TeX] Customising applescript macros

Will Robertson will at guerilla.net.au
Wed Aug 4 22:27:53 EDT 2004

Hi Alain

I'm going to forward this to the mailing list, so that everyone can see.
I hope you don't mind!

On 5 Aug 2004, at 6:47 AM, Alain Schremmer wrote:

> I immediately tried the tabular and it is very much faster to use.

Thanks! I'm very happy it's useful for you.

> I even changed back to ð because I am much less likely to misread it.
> But how do I change the default from "float" to "centered"?

Good question.
On about the 20th row down (don't bother counting!), you can see the
command to ask which tabular you'd like. It looks something like this:

> 	set q2 to display dialog "Enter the number of rows you'd like (not
> including a header row) and select whether you'd like a floating or
> simply centred table." default answer "3" buttons {"Cancel",
> "Centred", "Floating"} default button "Floating"

At the very end, you can change Çdefault button "Floating"È to Çdefault
button "Centred"È to make Centred the default. (Remove the ÇÈ, of
course!) In fact, if you want to go the whole hog, you can change:
> buttons {"Cancel", "Centred", "Floating"} default button "Floating"

to:
> buttons {"Cancel", "Floating", "Centered"} default button "Centered"

And now you have American spelling, "Centered" as default AND on the
far right.
As you can see, it's very easy to customise Applescript!

> A lot more important for me, though:
> How would I change the script for it to display the row entries
> vertically?

Sorry I didn't address this last time with you.
A word of warning: If you change the macro to do this, the scripts "Add
column" and "Delete column" will no longer work. I don't have time,
unfortunately, to write a more robust script.

> To see how it can be useful for editing, here is an example of a
> display which I evolved to guard the console against my many typos and
> other sins. (Note in particular the indent on the first entry of each
> row and the \\ aligned with %Row1.)
>
> \begin{tabular}{|c|c|c|c|c|c|c|}
> 	\hline
> 	%Row1
> 		    $\denom{x\;10}^{\textbf{+2}}$
> 		& $\denom{x\;10}^{\textbf{+1}}$
> 		& $\denom{x\;10}^{\textbf{0}}$
> 		& $\denom{x\;10}^{\textbf{-1}}$
> 		& $\denom{x\;10}^{\textbf{-2}}$
> 	\\
> 	%Row2
> 		    $\denom{Hamiltons}$
> 		& $\denom{Hamiltons}$
> 		& $\denom{Hamiltons}$
> 		& $\denom{Hamiltons}$
> 		& $\denom{Hamiltons}$
> 	\\
> 	\hline
> \end{tabular}
>
> versus
>
> \begin{tabular}{|c|c|c|c|c|c|c|}
> 	\hline
> 		$\denom{x\;10}^{\textbf{+2}}$ & $\denom{x\;10}^{\textbf{+1}}$ &
> $\denom{x\;10}^{\textbf{0}}$ & $\denom{x\;10}^{\textbf{-1}}$ &
> $\denom{x\;10}^{\textbf{-2}}$\\
> 		$\denom{Hamiltons}$ & $\denom{Hamiltons}$ & $\denom{Hamiltons}$ &
> $\denom{Hamiltons}$ & $\denom{Hamiltons}$\\
> 	\hline
> \end{tabular}

Two steps:
1. At the top of the script, change:
> property cell_text : "¥ "

to:
> property cell_text : "¥ " & return & indent & indent

This is just saying: instead of inserting "¥ " for every cell, put a
newline and some indents are it as well.

2. You'll want to adjust the indent of the first cell, so change:
> set the one_row_text to indent & indent & cell_text

(This line is about 1/2 to 2/3 towards the end of the script.)

to:
> set the one_row_text to indent & indent & indent & cell_text

Just more indents! You might want to add more to taste...

If you have any troubles, let me know!

Will
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>