0

It's my first time using pandoc, and my first time posting on here. I use TeX Maker to produce the LaTeX document to a PDF and it does not error. The Document class is report. I need to convert my LaTeX file to a docx file for my research advisor. I am using the latest version of pandoc (pandoc 3.1.9). The following commands I used to convert:

pandoc NMTthesis.tex -o mynewthesis.docx

Once I run this line of commands in windows command prompt, I get this error:

Error at "NMTthesis.tex" (line 197, column 1):
unexpected \@topnum
\chapter{Test READ BEFORE REPLACING THIS\protect\\ CHAPTER WITH YOUR CONTENT}
^

I have done some debugging through my LaTeX code and it did the same error with \listoftalbes, \listoffigures, and now, \chapters.

Does pandoc not like these LaTeX commands?

Thank you for your time and help.

More info:

I use MiKTeX and TeXmaker when creating my pdf. I am using windows command prompt to convert latex to docx with pandoc.

Here is the link to my university's latex template (NMTthesis.tex) which includes their own latex style file (NMTthesis2020.sty, custom usepackage): https://www.nmt.edu/gradstudies/thesis_information.php It will be the first link called LaTex Template. Below is the simplest latex document from my university (I shortened it to show what latex usepackage and commands are used. You will need usepackage \usepackage{NMTthesis2020} which is in the link provided):

\documentclass[12pt]{report}
\usepackage[sort&compress]{natbib}
\usepackage{NMTthesis2020}
\usepackage[hypertexnames=false]{hyperref}
\hypersetup{
    colorlinks = true,
    linkcolor = black,
    anchorcolor = black,
    citecolor = black,
    filecolor = black,
    urlcolor = black,
    pdfnewwindow = true,
    extension = pdf} 
\thesis

\author{Your Name Here}

\title{Place your title here, and use commands to break lines}

\degreeSought{Doctor of Philosophy in Mechanical Engineering with Dissertation in Intelligent Energetic Systems}

\thesiscompletiondate{May 12, 2020}

\graduationdate{June, 2020}

\academicadvisor{Ada Lovelace}

\researchadvisor{Ada Lovelace}

\committeesize{3}

\committeememberone{Committee Member 1}
\committeemembertwo{Committee Member 2}
\committeememberthree{Committee Member 3}
\committeememberfour{Committee Member 4}
\committeememberfive{Committee Member 5}

\begin{document}

\titlepage

\begin{dedication}
\end{dedication}

\begin{acknowledgments}
\end{acknowledgments}

\begin{abstract}
\keywords{Keyword1; Keyword2; Key Phrase 3; ...}
\end{abstract}

\tableofcontents

\listoftables

\listoffigures

\signaturepage
\chapter{Test READ BEFORE REPLACING THIS CHAPTER WITH YOUR CONTENT}

\chapter{SECOND CHAPTER TITLE}
\section{Section Title}
\subsection{Subsection Title}

\bibliographystyle{unsrt}
\bibliography{references}

\appendix
\chapter{1st app TITLE}
\section{First section of Appendix A}

\chapter{SECOND app TITLE}

\chapter{PERMISSIONS}

\copyrightpage

\end{document}
13
  • So I did some more debugging by make a new quick latex document that just had \chapter{Hello World!}. Pandoc converted it seemlessly to a docx without the numbering: Chapter 1 Hello World!. So the latex template I am using from my university is doing something to \chapter. So is there a way to include the latex style in the converison?
    – Alex
    Commented Dec 4, 2023 at 5:09
  • Edit the post (click on the Edit button/link below the post and add that information. You can include a link to the template/class as well.
    – Werner
    Commented Dec 4, 2023 at 5:52
  • Will do, Werner. I added the link to my uni's latex template.
    – Alex
    Commented Dec 4, 2023 at 6:02
  • 1
    Just to make sure: you know that htlatex exists and usually does a good job with converting LaTeX to html? And Word opens html-files?
    – Keks Dose
    Commented Dec 4, 2023 at 7:25
  • 1
    In order to be able to convert NMTthesis.tex to DOCX using pandoc, you can remove (or comment out) the line \global\@topnum=\z@ (line 901) in NMTthesis2020.sty. The result of conversion looks awful though. Commented Dec 4, 2023 at 7:47

0

You must log in to answer this question.

Browse other questions tagged .