For my LaTeX equations I use Mathtype's excellent capability of copying equations as TeX code. My minor problem arises when I want numbered equations in LaTeX and also want to type the equation in Mathtype rather than directly in the TeX language.

When I copy/paste an equation from Mathtype it comes out as either:

\[{a^2} + {b^2} = {c^2}\]


$${a^2} + {b^2} = {c^2}$$

depending on the copy settings in Mathtype.

However in my document I will wrap this equation in the equation environment (to get numbering) as follows:

{a^2} + {b^2} = {c^2}

I have to delete the \[ \] or $$ manually as these don't belong in the equation environment. Is it possible that TeXShop detects these symbols when pasted automatically and either deletes them or replaces them with \begin{equation} and \end{equation}?

So if I would just paste \[ it would replace it with \begin{equation}.

I understand this question itself is (too) specific, but if a solution exists it could apply to other copy/paste rituals people may have.


I have found a solution that almost fits my needs in Mountain Lion's Text Replacement tool.

  1. First enable the symbol and text substitution in the System Preferences.
  2. Configure it such that \[ is replaced by \begin{equation} and \] is replaced by \end{equation}. enter image description here
  3. Copy/paste the formula from Mathtype into the TeXShop document.
  4. Before compiling the code right click somewhere in the document and go to Substitutions -> Show Substitutions:
    enter image description here
  5. The following window opens: enter image description here Check Text Replacements and click on Replace All.
  6. Compile the document.

However, this does not substitute pasted in symbols automatically and requires an additional step. So I'm still looking for a "paste-time" method.

  • Well, if Mathtype gives you {a^2}+{b^2}={c^2} I wouldn't recommend using it.
    – egreg
    Apr 9, 2013 at 15:18
  • Why not? It works flawlessly here... Apr 9, 2013 at 15:20
  • If it adds those useless braces, I fear it adds others in places where they do evil.
    – egreg
    Apr 9, 2013 at 15:25
  • I see. This might of course be the case, I haven't tested this systematically. But I've used the workflow now for 3 years in university and have not encountered any errors with it yet, so it suits my needs. Except for the inconvenience described in the question. Apr 9, 2013 at 15:28

1 Answer 1


Easy, save the following file as "Latex (Texshop).tdl" into your "translator" folder.

MathType Output Translator 1.0: "Latex (Texshop)", "Daniel Wei 2013", language

include "LaTeX (base vars).tdl";
// redefinitions of base variables

var/"TranslatorName" = "Latex (Texshop)";
var/"TranslatorFileName" = "Latex (Texshop).tdl";

var/"BeginMathDisplay" = "\begin{equation}\label{}@n";
var/"EndMathDisplay" = "@n\end{equation}";

include "LaTeX (base rules).tdl";

Then in the Mathtype preference, just select "Latex (Texshop)" as your copying style.

  • And if you're worried about extra braces (like egreg), then you can tweak the tdl file to eliminate them. But I wouldn't recommend it.
    – bubba
    Mar 28, 2015 at 6:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .