Changing TextEdit Margins v2.0 (Using KBM v10.2)

This is an update of an earlier version posted in Questions and Suggestions. The changes in v2.0 are to replace all Execute Shell Script actions with KBM actions and to automatically click the Revert button as the last step.

The Problem with Changing Margins in TextEdit

One of the common complaints about TextEdit is that there is no way to change the page margins. The best advice on the internet is to create a template file in MS Word with the margins you want, save that as RTF and open that template in TextEdit whenever you want a file with those margins. Really?

Alternately, you can save the file twice, then change the TE preferences like this:


Then you would revert the file to previously saved version and TE will display the RTF code for the file:

Then you would manually edit the \margl and \margr values, add \margb and \margt values, save it twice, change the Preference back to not showing RTF code, and then restore the previous version.

Simple, right? No wonder everyone loves TextEdit (not!).

A KBM Solution

I've been working on a Keyboard Maestro alternative to changing margins in TextEdit. It's a work in progress so there are some things that I'd like to have it in that I haven't implemented yet, but in its current form, I'm finding it pretty useful.

=TextEdit Macros to Change Margins v2.0.kmmacros (159 KB)

Keyboard Maestro Export

There is an enhancement that I want to make, which I haven't started but which would make the user experience a bit smoother.

I would like to have a better interface for setting the desired margins. Right now it's just a Prompt With List that currently has eight simple choices.

I imagine replacing this with an HTML Prompt that would show the current values in the file and give you a chance to edit them individually, let you change units between TE's half-point scale to points, inches, centimeters, lock left and righ margins to the the same, etc. (TextEdit can't handle odd and even pages being different.)

If the final output from your RTF will be PDF files, you can add a margin of any size at the conversion stage, using pandoc.

For one inch margins, for example:

pandoc -f rtf -t pdf -V geometry:margin=1in noMargin.rtf -o withMargin.pdf

compare the output of that, with for example:

pandoc -f rtf -t pdf -V geometry:margin=2in noMargin.rtf -o bigMargin.pdf
1 Like

Thanks for that pandoc tip, @ComplexPoint.

My immediate concern is having comfortable margins for writing on the screen. It's a Goldilocks problem. Wrap to Window has no margin at all while Wrap to Page has a default of 1 inch margins. One is uncomfortably cramped while the other is an uncomfortable waste of space.

Perhaps I should include that in my introduction of why I wrote this.