Discussion:
Latex commands in math mode
Friedrich Hagedorn
2008-06-16 08:17:15 UTC
Permalink
Hello,

how can I add real latex commands in the math mode? I use Lyx 1.5.1 for
Linux.

E.g. I want to insert a

\intertext{blah blah}

before a equation, or add

\\[2em]

after a euqation. I tried Ctrl-l and '\' but this didnt work.

Thanks,

Friedrich
Bob Lounsbury
2008-06-16 14:17:50 UTC
Permalink
Post by Friedrich Hagedorn
Hello,
how can I add real latex commands in the math mode? I use Lyx 1.5.1 for
Linux.
E.g. I want to insert a
\intertext{blah blah}
before a equation, or add
\\[2em]
after a euqation. I tried Ctrl-l and '\' but this didnt work.
Thanks,
Friedrich
A quick google search revealed that \intertext is used in the AMS math
environment. So you need to enable:

Document->Settings->Math Options->Use AMS math package

Then you should be able to use \intertext in at least the AMS 'align'
environment. You should probably research how and where this command
is used. AMS align is found under Insert->Math.

I've attached a few screenshots showing the use of \intertext. I'm not
sure why you would need to use \\[2em] in a math environment. I show
the use of it outside of the math environment.

Cheers,
/Bob
Friedrich Hagedorn
2008-06-16 15:04:55 UTC
Permalink
Post by Bob Lounsbury
Post by Friedrich Hagedorn
how can I add real latex commands in the math mode? I use Lyx 1.5.1 for
Linux.
E.g. I want to insert a
\intertext{blah blah}
before a equation, or add
\\[2em]
after a euqation. I tried Ctrl-l and '\' but this didnt work.
A quick google search revealed that \intertext is used in the AMS math
Document->Settings->Math Options->Use AMS math package
Then you should be able to use \intertext in at least the AMS 'align'
environment. You should probably research how and where this command
is used. AMS align is found under Insert->Math.
I've attached a few screenshots showing the use of \intertext.
Oh, thanks. Is the "and" in the second screenshot typed with the \intertext
command or are theire two seperate math mode environments?
Post by Bob Lounsbury
I'm not sure why you would need to use \\[2em] in a math environment.
I show the use of it outside of the math environment.
I know that. And i want to have the same possibility in the math mode.
The \\[2em] was just an example (I need it some times ago in an array
environment to correct the vertical spacing).

I want to insert _arbitrary_ latex commands in the math mode. Otherwise
I must type my equations in a latex-ERT box.

Here is an other example.

\documentclass[a4paper]{scrartcl}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}

\begin{document}

This
\begin{align*}
f(z) & :=z^{2}\\
\intertext{with the substitution $z=\sqrt{x^2+y^2}$} & =x^2+y^2
\end{align*}
is important.

\end{document}

How would you input the \intertext command with lyx? I started with

"\intertext "
"\{with "

and now I am out of the brackets. An other problem is the local math mode
in $z=...$.

Thanks,

Friedrich
James Sutherland
2008-06-16 15:35:30 UTC
Permalink
Post by Friedrich Hagedorn
How would you input the \intertext command with lyx? I started with
"\intertext "
"\{with "
and now I am out of the brackets. An other problem is the local math mode
in $z=...$.
Can't you just use something like "\textrm" or "\mathrm"? These both
work in LyX math mode...
Bob Lounsbury
2008-06-16 15:46:54 UTC
Permalink
Post by Friedrich Hagedorn
Post by Bob Lounsbury
Post by Friedrich Hagedorn
how can I add real latex commands in the math mode? I use Lyx 1.5.1 for
Linux.
E.g. I want to insert a
\intertext{blah blah}
before a equation, or add
\\[2em]
after a euqation. I tried Ctrl-l and '\' but this didnt work.
A quick google search revealed that \intertext is used in the AMS math
Document->Settings->Math Options->Use AMS math package
Then you should be able to use \intertext in at least the AMS 'align'
environment. You should probably research how and where this command
is used. AMS align is found under Insert->Math.
I've attached a few screenshots showing the use of \intertext.
Oh, thanks. Is the "and" in the second screenshot typed with the \intertext
command or are theire two seperate math mode environments?
This was using the \intertext command, not two seperate math mode environments.
Post by Friedrich Hagedorn
Post by Bob Lounsbury
I'm not sure why you would need to use \\[2em] in a math environment.
I show the use of it outside of the math environment.
I know that. And i want to have the same possibility in the math mode.
The \\[2em] was just an example (I need it some times ago in an array
environment to correct the vertical spacing).
I want to insert _arbitrary_ latex commands in the math mode. Otherwise
I must type my equations in a latex-ERT box.
Here is an other example.
\documentclass[a4paper]{scrartcl}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\begin{document}
This
\begin{align*}
f(z) & :=z^{2}\\
\intertext{with the substitution $z=\sqrt{x^2+y^2}$} & =x^2+y^2
\end{align*}
is important.
\end{document}
How would you input the \intertext command with lyx? I started with
"\intertext "
"\{with " and now I am out of the brackets.
It seems this \intertext command is not properly handled in LyX. I had
the same problem, when you press 'space' it jumps you out of the
command. You may want to file this as a bug or feature enhancement.
I'm not sure which it would be.

You may be stuck to ERT for this true AMS functionality.

Cheers,
/Bob
Nigel Pegram
2008-06-18 00:04:30 UTC
Permalink
What happens if you use ctrl-space, instead of space?
Post by Bob Lounsbury
Post by Friedrich Hagedorn
Post by Bob Lounsbury
Post by Friedrich Hagedorn
how can I add real latex commands in the math mode? I use Lyx 1.5.1 for
Linux.
E.g. I want to insert a
\intertext{blah blah}
before a equation, or add
\\[2em]
after a euqation. I tried Ctrl-l and '\' but this didnt work.
A quick google search revealed that \intertext is used in the AMS math
Document->Settings->Math Options->Use AMS math package
Then you should be able to use \intertext in at least the AMS 'align'
environment. You should probably research how and where this command
is used. AMS align is found under Insert->Math.
I've attached a few screenshots showing the use of \intertext.
Oh, thanks. Is the "and" in the second screenshot typed with the \intertext
command or are theire two seperate math mode environments?
This was using the \intertext command, not two seperate math mode environments.
Post by Friedrich Hagedorn
Post by Bob Lounsbury
I'm not sure why you would need to use \\[2em] in a math environment.
I show the use of it outside of the math environment.
I know that. And i want to have the same possibility in the math mode.
The \\[2em] was just an example (I need it some times ago in an array
environment to correct the vertical spacing).
I want to insert _arbitrary_ latex commands in the math mode. Otherwise
I must type my equations in a latex-ERT box.
Here is an other example.
\documentclass[a4paper]{scrartcl}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\begin{document}
This
\begin{align*}
f(z) & :=z^{2}\\
\intertext{with the substitution $z=\sqrt{x^2+y^2}$} & =x^2+y^2
\end{align*}
is important.
\end{document}
How would you input the \intertext command with lyx? I started with
"\intertext "
"\{with " and now I am out of the brackets.
It seems this \intertext command is not properly handled in LyX. I had
the same problem, when you press 'space' it jumps you out of the
command. You may want to file this as a bug or feature enhancement.
I'm not sure which it would be.
You may be stuck to ERT for this true AMS functionality.
Cheers,
/Bob
Pavel Sanda
2008-06-18 00:42:00 UTC
Permalink
Post by Bob Lounsbury
It seems this \intertext command is not properly handled in LyX. I had
the same problem, when you press 'space' it jumps you out of the
command. You may want to file this as a bug or feature enhancement.
I'm not sure which it would be.
this is not a bug, this is a feature. if you want to use space in math mode you
have to use latex space commands e.g. "\:" (either via toolbar or
ctrl+space(+space...to cycle through possible spaces) or math-space lfun.
second possibility is to switch to text mode inside math (ctrl+m when you are
already in math mode).

you can use any latex commands in math mode without any ERT.

pavel
G. Milde
2008-06-18 07:28:04 UTC
Permalink
Post by Pavel Sanda
Post by Bob Lounsbury
It seems this \intertext command is not properly handled in LyX. I had
the same problem, when you press 'space' it jumps you out of the
command.
this is not a bug, this is a feature.
It is intended as a feature, but might turn out to be not "the right
thing".
Post by Pavel Sanda
If you want to use space in math mode you have to use latex space
commands e.g. "\:" (either via toolbar or ctrl+space(+space...to cycle
through possible spaces) or math-space lfun.
This is the case if you want to produce *visible* space in the output.

However, there is no way you can tell LyX to generate a space character
in the latex code.

In most circumstances, this is not a problem because TeX ignores
whitespace in math mode. However, some extensions and packages depend on
whitespace for disambiguation.

Example: Package icomma cannot be used with LyX (short of using ERT
*instead* of a math box) as it relies on input in the form
$f(x, y) = 3,45$ to disambiguate a decimal separator from a variable
separator and generate the correct spacing. (German typography uses the
comma as decimal separator.)

\usepackage{icomma} % Komma als Dezimaltrenner (im Mathe Modus)
% Standardmäßig läßt LaTeX im Mathe Modus immer etwas
% Platz nach einem Komma, für 3,45 etc. ist das falsch.
% Mit icomma gilt:
% Wenn auf das Komma ein Leerzeichen folgt, soll auch
% eins kommen, wenn nicht, schreibe es als Operator:
% z.B. $f(x, y) = 3,45$
% Geht nicht mit LyX, da der Leerzeichen in Mathe
% unterdrückt.
Post by Pavel Sanda
Second possibility is to switch to text mode inside math (ctrl+m
when you are already in math mode).
This will not allow you to generate the LaTeX code $f(x, y) = 3,45$.
Post by Pavel Sanda
you can use any latex commands
that do not contain space characters
Post by Pavel Sanda
in math mode without any ERT.
Günter
Friedrich Hagedorn
2008-06-18 10:51:03 UTC
Permalink
Post by Friedrich Hagedorn
How would you input the \intertext command with lyx? I started with
"\intertext "
"\{with "
and now I am out of the brackets. An other problem is the local math mode
in $z=...$.
Can't you just use something like "\textrm" or "\mathrm"? These both work
in LyX math mode...
Yes, but only for the case

\intertext{\textrm{blah blah blah}}

^^^^^^^
This is only a workaround for the lyx input!

and not for the case

\intertext{with substitution $z=x^2$}

I cant input the $z=...$.

The problem is that the argument of \intertext is real text and not
typesetted in math mode. But lyx interpreted the argument of {...} as
math commands.

The easiest solution would be a ERT environment in the math mode to handle
such specific math commands. Günter Milde showed an other example (the
icomma package) for this need.

Thanks,

Friedrich

Loading...