help-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Gavin Smith
Subject: Re: [help-texinfo] Inserting text in tex math mode
Date: Sat, 17 Jun 2017 12:45:23 +0100

(You would likely have got a response earlier had your email not been all HTML.)

On 13 June 2017 at 18:39, Christopher Dimech <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]