LyXundefined control sequence on a defined macro

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
orenshk
Posts: 4
Joined: Mon Mar 26, 2012 4:09 am

undefined control sequence on a defined macro

Post by orenshk »

Hello,

I seem to be experiencing an odd issue with lyx.

I have a macro mapping \leq to \leqslant.
Withing the document I'm editing this works fine, but if I start a new document in which the only macro is the one above and the only symbol is \leq, I get an undefined control sequence error. There are other macros of mine for which this occurs, for example I mapped \ints to \mathbb{Z}, which I've used in new documents in the past. As a process of elimination I removed paragraphs from my original document, until I managed to reproduce the error. It turns out that if the \subsetneq symbol is present, lyx compiles with no issue, but if its removed we're back to the error. I should note that I tried lyx on two different machines. Also, when pasting the latex source into scribtex, without the \subsetneq it compiles just fine.

Here's the source -

Code: Select all

% Preview source code

%% LyX 2.0.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[11pt,oneside,english]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1.25in,rmargin=1.25in}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}

\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{figure}{section}

\@ifundefined{date}{}{\date{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[all]{xy}
\let\oldenumerate=\enumerate
\def\enumerate{\oldenumerate%
\setlength{\itemsep}{5pt}\setlength{\parsep}{5pt}}%
\usepackage{mathrsfs}
\usepackage[linktoc=all]{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}
\usepackage{todonotes}

\makeatother

\usepackage{babel}
\begin{document}
\global\long\def\leq{\leqslant}


$\subsetneq\leq$ 
\end{document}
I'm pretty stumped. Anyone encountered this before?

Thanks in advance.

P.S.
I don't know that \subsetneq is the only symbol that works, it's just the only one I've found that works.

P.P.S
Sorry if this problem has already been asked, I couldn't find it in a search.

Thanks.

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

Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

undefined control sequence on a defined macro

Post by Stefan Kottwitz »

Hi,

this source code example works without error, with and without \subsetneq.

Perhaps post your .log file here, as attachment.

Stefan
LaTeX.org admin
orenshk
Posts: 4
Joined: Mon Mar 26, 2012 4:09 am

undefined control sequence on a defined macro

Post by orenshk »

Hi,

thanks for the quick reply. Here's the log file for compiling without \subsetneq.
Attachments
test.log
The obtained log file.
(26.35 KiB) Downloaded 640 times
orenshk
Posts: 4
Joined: Mon Mar 26, 2012 4:09 am

Re: undefined control sequence on a defined macro

Post by orenshk »

Addendum: It seems to have something to do with the ams package. using any ams symbol directly (no macro) anywhere in the document, allows for compilation. This includes actually calling \leqslant, followed by \leq (with \leq --> \leqslant).
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

undefined control sequence on a defined macro

Post by Stefan Kottwitz »

In the .log file, amssymb is not mentioned. This package (or another one such as MnSymbol) is required for \leqslant, so also for \leq.

If you use \subsetneq or another amssymb symbol, LyX detects that and automatically loads amssymb, which makes the document compilable with the \leq definition. You can load amssymb yourself. For this, open in the main menu Document, Settings, go to LaTeX Preamble, there add

Code: Select all

\usepackage{amssymb}
Stefan
LaTeX.org admin
orenshk
Posts: 4
Joined: Mon Mar 26, 2012 4:09 am

Re: undefined control sequence on a defined macro

Post by orenshk »

That's works perfectly, thanks!
Out of curiosity then, why did it work when I compiled to tex source, outside of Lyx?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10328
Joined: Mon Mar 10, 2008 9:44 pm

undefined control sequence on a defined macro

Post by Stefan Kottwitz »

orenshk wrote:Out of curiosity then, why did it work when I compiled to tex source, outside of Lyx?
I guess you used amssymb or scribtex loaded it. The .tex source in your question also shows amssymb.

Stefan
LaTeX.org admin
Post Reply