Does \newcommand work?

I’m experimenting with Docx2LaTeX to see if it is feasible for use to do collaborative editing for a latex document that consists of mixed manually created and generated latex. The project is also stored in git so ideally changes in git would be reflected in the document.

Some of the generated latex uses custom commands which are currently defined is a cls file.

I was testing to see if \newcommand works. For a simple command that only returned text it worked if defined in the LaTeX block that uses it. It did not work by putting the \newcommand in the first latex block along with the documentclass.

\newcommand{\sayhello}[1]{Hello #1}
\sayhello{Mike}

Attempting to define a new command with use of ifthenelse fails. \usepackage{ifthen} is included alongside \documentclass in the first latex block.

\newcommand{\dayOfWeek}[1]
{
\ifthenelse{\equal{#1}{0}}{Sunday}{}
\ifthenelse{\equal{#1}{1}}{Monday}{}
\ifthenelse{\equal{#1}{2}}{Tuesday}{}
\ifthenelse{\equal{#1}{3}}{Wednesday}{}
\ifthenelse{\equal{#1}{4}}{Thursday}{}
\ifthenelse{\equal{#1}{5}}{Friday}{}
\ifthenelse{\equal{#1}{6}}{Saturday}{}
}
\dayOfWeek{0}
\dayOfWeek{4}

Modifying one of the existing templates to add \usepackage{ifthenelse} fails to generate the PDF so I’m assuming the issue is with the usepackage. Is it generally the case that only packages already installed by Docx2LaTeX will be usable?

We tested the scenarios you mentions both of them produce desired output.
Test Case 1:
Code:


Output:

Test Case 2:
Code:


Output:

Is there any other test case you were referring to?

Well, unfortunately, it isn’t working for me…

Use Convet To > LaTeX Source Code button and inspect the LaTeX source code to see what is going wrong.

Unzipping the resulting file and running pdflatex directly results in the expected output… however, selecting the block and clicking the render button results in the image show previously.

I’ve made the document accessible at the following link if it helps to diagnose:

Ohh, so those screenshots were of rendered output!
Render feature is given only to get quick intuition of code block mostly for equations and tikz pictures .
However you should always prefer and trust output produced by, convert to PDF file button.