# How to use latex2rtf to convert tex to word with custom class file

I am using a latex template which has a custom class file resume.cls. I want to convert this file to a word or rtf using latex2rtf package on Ubuntu.

The instruction is not very clear to me, and I am not sure how to make sure it includes the class file. Has anyone used latex2rtf for conversion?

• Almost certainly there will be things in your custom class that latex2rtf will not understand. It does not even try to translate anything except a small subset of commonly used LaTeX commands. For anything other that plain text and headings, I have always found that it's easier just to cut and paste from the PDF into Word and basically rewrite all the formatting. Good luck! – Thruston Apr 25 '16 at 17:35

This is one of the major challenges with latex2rtf; it's almost inevitably going to be unable to cope with custom style files because the writers of latex2rtf don't know what's in that style file.

My usual solution is to use the \iflatex2rtf{} boolean. This means you can set out code that works with the converter, and code that works with normal 'tex using a switch.

You'll find the following in the manual:

...start by defining the following line in the preamble of your document before \begin{document}):

\newif\iflatextortf


[then you can use the right commands for the right compiler:]

\iflatextortf
% This code is processed only by latex2rtf
\else
% This code is processed only by latex
\fi


To make this work with a custom class, you use the first clause to replace any commands that are specific to the resume class with standard latex commands, using \newcommand{}{}. In the second clause, you just call the resume class as normal.

So: you might end up with this in your preamble:

\newif\iflatextortf

\iflatextortf
% This code is processed only by latex2rtf
\documentclass[12pt,letterpaper]{article}
% redefine resume class commands
\newcommand{\affiliation}{some code}
\newenvironment{\compactitem}{some other code}
% and so-on
\else
% This code is processed only by latex
\documentclass[12pt,letterpaper]{resume}
\fi


What might be difficult is to figure out exactly how to replace those resume.cls commands with something that makes sense in the latex that latex2rtf knows how to deal with.