title: Pandoc produces error from .tex to .docx on redefinition of \part
body: <p>On using pandoc to convert a LaTeX file to a Word document I ran into the following error:</p>
  
  <pre><code>...&gt;pandoc test.tex -o test.docx  --pdf-engine=xelatex
  
      Error at "source" (line 12, column 1):
      unexpected \part
      expecting \end{document}
      \part{Introduction}
      ^
  </code></pre>
  
  <p>The error occurs also with <code>pandoc test.tex -o test.docx</code>. Here is a minimal example that compiles with XeLaTeX but produces the error in pandoc :</p>
  
  <pre><code>%test.tex
  \documentclass{book}
  \newcommand*\parttitle{}\let\origpart\part
  \renewcommand*{\part}[2][]{\ifx\\#1\\%
        \origpart{#2}%
        \renewcommand*\parttitle{#2}%
     \else
        \origpart[#1]{#2}%
        \renewcommand*\parttitle{#1}%
      \fi
  }
  \begin{document}
  \part{Introduction}
  \chapter{Context}
  \section{Lorem}
  Lorem ipsum dolor sit amet, 
  consectetuer adipiscing elit. 
  Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. 
  Curabitur dictum gravida mauris.
  \end{document}
  </code></pre>
  
  <p>The redefinition of <code>\part</code> comes from  <a href="https://tex.stackexchange.com/a/13392/44805">this answer</a> on Tex SE. On the other hand using the answer chosen by the OP, pandoc doesn't complain:</p>
  
  <pre><code>%test.tex
  \documentclass{book}
  \let\Oldpart\part
  \newcommand{\parttitle}{}
  \renewcommand{\part}[1]{\Oldpart{#1}\renewcommand{\parttitle}{#1}}
  \begin{document}
  \part{Introduction}
  \chapter{Context}
  \section{Lorem}
  Lorem ipsum dolor sit amet, 
  consectetuer adipiscing elit. 
  Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. 
  Curabitur dictum gravida mauris.
  \end{document}
  </code></pre>
  
  <p>What difference causes the error in the first ?</p>