# Cleaning up TeXmacs LaTeX export

I recently found TeXmacs, and I find it excellent for quick note taking (for me, typing LaTeX is much too slow and messy for that). One of the reasons why I'm hoping TeXmacs will be useful for this is that it seems to have pretty decent LaTeX export. But it's not perfect. This question is about how to clean up the LaTeX exported by TeXmacs to make it suitable for sending to collaborators and submitting to journals.

There are really two main difficulties I found:

1. In math mode, instead of $f(x)$, TeXmacs loves to produce $f ( x)$. This example is trivial, but with complex formulae all those extra spaces around the first bracket make things unreadable enough that I can't send the document like this to collaborators. Take for example something like \frac{d^2}{d x^2} \ln f ( x) = \frac{f'' ( x)}{f ( x)} - \frac{f' ( x)^2}{f ( x)^2}

2. Instead of the usual \textbf, \emph, etc., TeXmacs produces \tmtextbf, \tmtexit, etc. with definitions such as \newcommand{\tmtextbf}[1]{{\bfseries{#1}}}. This can be good, as it's customizable, but in a simple document that doesn't use much more formatting than this it'd be better to have just the standard \textbf, etc. Is there a way to easily expand these?

3. Where I'd write i.e.\ something in LaTeX, I get {\tmabbr{i.e.}} something. Again, is there an easy way to fix this?

Does anyone here use TeXmacs to produce LaTeX? If yes, do you post-process the output? How?

Is it possible to (easily) configure TeXmacs to produce LaTeX that's more suitable for my needs? Or are there tools for post processing TeXmacs output?

• I'm having some difficulty finding the correct tags to use. I'd appreciate some help with that. Also, I hope this question is not of topic. TeXmacs is not LaTeX, but it's pretty closely related, and what I'm interested in is how to produce human-readable, human-editable LaTeX with TeXmacs. May 7 '13 at 14:49
• A texmacs tag seems appropriate here: I've added one. Certainly the question is as on-topic as many other editor-focussed ones. May 7 '13 at 14:51

## 1 Answer

It seems I found most of the answers:

For point 1., upgrade to TeXmacs 1.0.7.19 (I had 1.0.7.17).

For points 2. and 3., go to Preferences -> Convert -> LaTeX and disable "Allow macro definitions in preamble." Also, when writing, use emphasized instead of of italicized text (they look the same but apparently are not the same in TeXmacs). I've yet to figure out how to have a convenient shortcut key for emphasis (F5 is not...), how to auto-convert all italics to emphasized text, or how to tell the difference between them (TeXmacs is WYSIWYG).

• You could use sed. In a terminal: sed -i.sed 's/\\textit{/\\emph{/' mytexfile.tex. This will replace all instances of \textit{ with \emph{ in your file mytexfile.tex and create a backup of the original with the name mytexfile.tex.sed. (If I used texmacs I'd try to help on that side, but I only used it once or twice about five years ago and then uninstalled it.)
– jon
May 7 '13 at 16:47