Re: [help-texinfo] Inserting text in tex math mode

2017-06-17 Thread Karl Berry
However, there is no space after the text (with \r{if} or with \r{if
}). I haven't researched why this is, but I expect it depends on the
details of how @r is implemented in texinfo.tex.

It's not about @r (that just changes fonts). In TeX math mode, spaces
in the input are ignored, because TeX puts in its own spacing.

You could get a normal word space with
$$ \r{if } ... $$
but normally you don't want word spaces in math, but rather actual math
spacing amounts, e.g., \; for a so-called thick space, etc.

Really supporting display math in Texinfo (including xrefs) has been
on the todo list forever. Not to mention math itself. --happy hacking, karl.



Re: [help-texinfo] Inserting text in tex math mode

2017-06-17 Thread Gavin Smith
On Sat, Jun 17, 2017 at 01:24:59PM +0100, Paul Jakma wrote:
> Ah, not defined. I think that requires the LaTeX amsmath package. A
> \usepackage{amsmath} inside the @tex doesn't make it available.

You cannot use any LaTeX packages in Texinfo source.



Re: [help-texinfo] Inserting text in tex math mode

2017-06-17 Thread Paul Jakma

On Sat, 17 Jun 2017, Paul Jakma wrote:


On Tue, 13 Jun 2017, Christopher Dimech wrote:


 I have the following tex contruct and want to add text inside the math
 expression, for example adding

  

 i.e. if
  
 before \exists. However I am not sure how to tell texinfo to write this
 as text mode within math expression.
  
 @tex
 $$ \exists \ s \ :: \
     n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $$
 @end tex


I don't know if texinfo changes things, but in LaTeX I always use \text to 
insert text inside math. So something like:


\text{if } \exists  


Ah, not defined. I think that requires the LaTeX amsmath package. A 
\usepackage{amsmath} inside the @tex doesn't make it available.


regards,
--
Paul Jakma | p...@jakma.org | @pjakma | Key ID: 0xD86BF79464A2FF6A
Fortune:
Lieberman's Law:
Everybody lies, but it doesn't matter since nobody listens.

Re: [help-texinfo] Inserting text in tex math mode

2017-06-17 Thread Paul Jakma

On Tue, 13 Jun 2017, Christopher Dimech wrote:

I have the following tex contruct and want to add text inside the math 
expression, for example adding

  

i.e. if
 
before \exists. However I am not sure how to tell texinfo to write this
as text mode within math expression.
 
@tex
$$ \exists \ s \ :: \
    n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $$
@end tex


I don't know if texinfo changes things, but in LaTeX I always use \text 
to insert text inside math. So something like:


\text{if } \exists  

regards,
--
Paul Jakma | p...@jakma.org | @pjakma | Key ID: 0xD86BF79464A2FF6A
Fortune:
The inherent vice of capitalism is the unequal sharing of blessings;
the inherent virtue of socialism is the equal sharing of misery.
-- Churchill

Re: [help-texinfo] Inserting text in tex math mode

2017-06-17 Thread Gavin Smith
(You would likely have got a response earlier had your email not been all HTML.)

On 13 June 2017 at 18:39, Christopher Dimech  wrote:
> I have the following tex contruct and want to add text inside the math
> expression,
> for example adding
>
> i.e. if
>
> before \exists. However I am not sure how to tell texinfo to write this
> as text mode within math expression.
>
> @tex
> $$ \exists \ s \ :: \
> n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $$
> @end tex

$$ switches into the display math mode of TeX.

I found that using the @r command of Texinfo, non-italic text could be included:

$$ \r{if} \exists \ s \ :: \
> n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $$

However, there is no space after the text (with \r{if} or with \r{if
}). I haven't researched why this is, but I expect it depends on the
details of how @r is implemented in texinfo.tex.

You can make a larger space be inserted in display math mode itself by
changing the class

$$ \mathop{\r{if}} \exists \ s \ :: \
  n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $$

This is probably an abuse of \mathop though.

Alternatively, do not use display math at all:

if $\exists \ s \ :: \
  n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $

(Obviously this changes other aspects of the formatting too.)

You can nest formatting in non-math modes by using a box:

$$ \hbox{if } \exists \ s \ :: \
  n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $$

Here a space is typeset in horizontal mode after the "if". (The box
resulting from the use of the \hbox command is an atom of the ordinary
class, according to chapter 26 of "The TeXbook" by Donald Knuth.)

Or indeed, with an explicit space with "\ ", as you have done already
elsewhere in the formula:

$$ \hbox{if} \  \exists \ s \ :: \
  n(a^{tlv}_{s1},a^{tlv}_{s2},a^{tlv}_{s3}) \geq 2 $$

You could also look at
https://tex.stackexchange.com/questions/3415/what-is-the-correct-way-of-embedding-text-into-math-mode
or http://www.tex.ac.uk/FAQ-mathstext.html. I haven't looked at those
pages in detail, and be aware that some of what is recommended there
may not be usable with plain TeX, only with LaTeX.