LyXIntegrals already defined

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
GianGesù
Posts: 3
Joined: Sun Apr 21, 2013 10:21 am

Integrals already defined

Post by GianGesù »

Hi!

I'm a T.A. for a calculus course and I like writing the homework solutions in LyX so the students can check them out. I usually load amsmath when I write this kind of documents and I didn't have any problem until now when I tried to write an integral. The error that LyX gives is:

Code: Select all

LaTeX Error: Command \iint already defined.
LaTeX Error: Command \iiint already defined.
LaTeX Error: Command \iiiint already defined.
Even if I only use a single integral \int in the document. Below, in the "Description" window, LyX gives:

Code: Select all

...d{\iint}{\DOTSI\protect\MultiIntegral{2}}
                                                  
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.
I'm using MikTeX 2.9 and LyX 2.0.5.1. The document I wrote when I got these error messages was:

Code: Select all

\usepackage{amsmath}

\begin{document}
If I load \emph{amsmath}, \LyX{} won't compile the file when I write
an integral like $\int\mathrm{d}V$.
\end{document}
I'd appreciate your help. Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Integrals already defined

Post by cgnieder »

Hi and welcome to the LaTeX community?

Do you by any chance use the newtx fonts for your document? This is a common error when they're combined with amsmath:

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}

\usepackage{newtxmath}
\usepackage{amsmath}

\begin{document}

text

\end{document}
This can be prevented when amsmath is loaded before newtxmath.

If this doesn't help it would be easiest if you could attach a minimal .lyx file (cf. Minimal Working Example) that we could test.

Regards
site moderator & package author
GianGesù
Posts: 3
Joined: Sun Apr 21, 2013 10:21 am

Integrals already defined

Post by GianGesù »

Thank you, cgnieder!

I have never used any newtx font. What I do is to define commands for symbols I use constantly through the document I write, so I need to load amsmath to use \DeclareMathOperator. I send you a very brief example, hoping it's a well suited MWE.

Regards,
GianGesù
Attachments
aMWE.lyx
(1.83 KiB) Downloaded 517 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Integrals already defined

Post by cgnieder »

There should be no need to load amsmath via \usepackage. I didn't find where exactly the conflict exactly comes from but I suspect that it is to do with the esint package. your MWE compiles if I remove the

Code: Select all

\usepackage{amsmath}
line from the preamble and change LyX' math settings from automatic to explicit:
lyx_amsmath.png
lyx_amsmath.png (30.89 KiB) Viewed 18497 times
It did also work with all settings enabled (explicitly)

Regards
site moderator & package author
GianGesù
Posts: 3
Joined: Sun Apr 21, 2013 10:21 am

Re: Integrals already defined

Post by GianGesù »

Thank you, cgnieder --once again!

Everything's working perfectly now.

Regards,
GianGesù
Post Reply