jeslago / optidef

A Latex library for optimization problems
57 stars 3 forks source link

Error using class file of Wiley journal OCAM #20

Closed mheitel closed 5 years ago

mheitel commented 6 years ago

First of all, thank you for this great and useful LaTeX package!

I am currently writing a paper which I want to submit to the Wiley journal Optimal Control Applications and Methods (OCAM). They use a special class file It seems that using both optidef and this class file causes the following two errors while compiling:

Argument of \env@new has an extra }. \end{document} Paragraph ended before \env@new was complete. \end{document}

A minimal example that produces this error is given by

\documentclass[AMA,STIX1COL]{WileyNJD-v2}
\usepackage{optidef}

\begin{document}
    This is some text \cite{article01}

    \begin{mini!}{x}{f(x)}{\label{mylabel}}{}
        \addConstraint{g(x)}{\le 0}
        \addConstraint{h(x)}{= 0}
    \end{mini!}

    \bibliographystyle{plain}
    \bibliography{miniLiterature}
\end{document}

where the miniLiterature.bib file is just a small bib file with

@article{article01,
    author = {surname familyname},  
    title = {title},
    journal = {journal},
    year = {2000},
    volume = {volume},
    number = {number}, 
    pages = {pages}, 
    month = {month}, 
    note = {note},
}
jeslago commented 6 years ago

Hi,

could you provide the WileyNJD-v2 style?

In addition, if would recommend you not to use optidef for submitting the paper. At the moment I don't have much time for looking into the problem, so waiting for fixing the problem might delay your submission,

Cheers.

mheitel commented 6 years ago

Yes, of course, I can. Unfortunately, GitHub does not support .cls files for attachments. Therefore, I have updated the link of my first post. It should work now.

Thanks for your fast answer.

jeslago commented 5 years ago

Sorry for the late reply. This bug was harder to track than usual.

I have looked into the issue and I think it is not a problem between optidef and the WileyNJD-v2 class file. Instead, it seems to be a problem between the package environ and the WileyNJD-v2 class file. In your example above, if you replace the line where you import optidef by the package environ and then define an environment, i.e.:

\documentclass[AMA,STIX1COL]{WileyNJD-v2}
\usepackage{environ}
\NewEnviron{BaseMiniwe}[4]{}%

\begin{document}
    This is some text \cite{article01}

\bibliography{wileyNJD-AMA}%

\end{document}

the same issue that you mentioned pops up. As optidef relies on the package environ to define the environments, there is nothing much I can do to help you. Perhaps you could contact the developers of the environ package and ask them if they know what the issue is.

mheitel commented 5 years ago

Thanks for your reply. I did not use optidef for the submission of my paper. Since this problem occurred only in combination with the WileyNJD-v2 class file, which I use very rarely, it seems not that important for me to solve this issue. I hoped that it would be a minor bug. Thanks for tracking the problem!

jeslago commented 5 years ago

I am closing then this issue.