forked from NREL/latex_editing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakingDOCFiles.tex
61 lines (50 loc) · 5.25 KB
/
MakingDOCFiles.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
\section{Preparing a .DOC or .DOCX file from LaTeX}\label{sec:latextortf}
LaTeX users may find that they are required to convert their files into other formats for review or editing. This section describes how LaTeX files can be converted into \emph{.doc} or \emph{.docx} files for use with Microsoft Word.
\subsection{The conversion process}
The NREL style has been designed to be converted into \emph{.doc} or \emph{.docx} via rich text format (\emph{.rtf}). The process is:
\begin{enumerate}
\item Use \texttt{latex2rtf} to convert \emph{.tex} files into \emph{.rtf}
\item Use a WYSIWYG word processor such as Microsoft Word to open the \emph{.rtf} file and save it as a \emph{.doc} or \emph{.docx} file.
\end{enumerate}
Although other tools such as Pandoc may appear to offer some of this capability, they have not been tested with the NREL class.
\subsection{How does \texttt{latex2rtf} work?}
The \texttt{latex2rtf} program reads LaTeX files and converts common LaTeX commands into their RTF equivalent. It is effectively another LaTeX interpreter that knows a limited subset of LaTeX. See the documentation at \href{http://sourceforge.net/projects/latex2rtf/}{http://sourceforge.net/projects/latex2rtf/} for details.
\subsection{Using \texttt{latex2rtf}}
To convert a document from LaTeX to RTF, follow these steps:
\begin{enumerate}
\item Install \texttt{latex2rtf}
\item Compile the document in LaTeX using the NREL class with the \texttt{book,report}, or \texttt{article} option, remembering to update the bibliography and cross references. The sequence of commands is:
\item Convert the document to RTF format using \texttt{latex2rtf}.
\item Open the RTF file in Microsoft Word.
\item If the document contains tables of contents, tables of figures, tables of tables, or cross-references, select that text and update the fields.
\item Save the RTF file as a word-format document.
\end{enumerate}
\subsection{Using \texttt{latex2rtf} and LaTeX together}
Because \texttt{latex2rtf} only knows a subset of LaTeX, it is important to account for this when preparing a LaTeX document. The biggest problem is the lack of many packages, which is why authors are encouraged to use the NREL class file, which is known to work well with \texttt{latex2rtf}. Sometimes, though, it is important to be able to remove formatting for compatibility with \texttt{latex2rtf}, and so the preamble to this document includes a check to see if \texttt{latex2rtf} is being used:
\begin{verbatim}
\newif\iflatextortf
\iflatextortf
\documentclass[12pt,letterpaper]{report}
\input{NRELLatex2rtf.tex}
\else
\documentclass[report]{nrel}
\fi
\end{verbatim}
If \texttt{latex2rtf} is used, the boolean, \texttt{\textbackslash iflatextortf} will be TRUE and the commands will be interpreted as follows.
\begin{enumerate}
\item Set the document class to a generic LaTeX{} \emph{article}, \emph{report}, or \emph{book}.
\item The file \emph{NRELLatex2rtf.tex} will be called, which maps most of the commands that are enabled in \emph{nrel.cls} to simpler versions that can be processed using \texttt{latex2rtf} (see Table \ref{Tab:Packages}).
\end{enumerate}
Authors that use packages other than those listed in Table \ref{Tab:Packages} may need to adjust the content of \emph{NRELLatex2rtf.tex} according to their needs.
\subsection{Indexes}
Index entries will not be correctly converted to an \emph{.rtf} file. \emph{NRELLatex2rtf.tex} redefines the \verb+index+ command to do nothing when creating an \emph{.rtf} file.
\subsection{What to do when the conversion to rich text format fails}
It is more than likely that the conversion to an \emph{.rtf} file will fail at some point. There are a few ways to deal with this:
\begin{description}
\item[Convert early and often.] Check that the document converts using \texttt{latex2rtf} every time a new environment is added.
\item[Try section-by-section.] Comment out the majority of the document and try to compile bit-by-bit. This will let you localize the error.
\item[Check new packages.] Please avoid using new packages. If a package has to be used, try the conversion immediately. If \texttt{latex2rtf} doesn't support the package, edit the file \emph{NRELLatex2rtf.tex} to redefine those commands to something that will convert appropriately. Put \emph{NRELLatex2rtf.tex} in the same directory as the LaTeX file to be converted.
\item[Avoid custom commands.] \texttt{latex2rtf} sometimes chokes on custom commands. A list of all recognized commands is available in the manual at \href{http://latex2rtf.sourceforge.net/latex2rtf.pdf}{http://latex2rtf.sourceforge.net/latex2rtf.pdf}. If custom commands are used, they may need to be redefined to work with the commands that \texttt{latex2rtf} does recognize. This can also be done in \emph{NRELLatex2rtf.tex}. You can check macros using the flag \verb+-d2+ when running \texttt{latex2rtf}.
\item[Use copy-paste.] Compile the whole document as a PDF, and save it somewhere. Then recompile using the reduced document that works with \texttt{latex2rtf}. Edit this in word and copy in the bits that killed the conversion.
\item[Talk to a communications rep.] If a document cannot be produced any other way than LaTeX with lots of packages, and \texttt{latex2rtf} just refuses to process it into a rich text file, discuss the process for having the PDF processed.
\end{description}