help-texinfo
[Top][All Lists]
Advanced

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

Macros inside @displaymath


From: Gavin Smith
Subject: Macros inside @displaymath
Date: Sat, 14 Nov 2020 08:49:05 +0000
User-agent: Mutt/1.9.4 (2018-02-28)

On Thu, Nov 12, 2020 at 01:15:33PM +0100, Patrice Dumas wrote:
> On Thu, Nov 12, 2020 at 11:57:47AM +0100, Christopher Dimech wrote:
> > Have done more tests with @tex, @math, and @displaymath.
> > 
> > \gdef is working for pdf output but not with MathJax.
> 
> I am not an expert in MathJax, but I think that MathJax only interpret
> the LaTeX/TeX locally, so cannot know about \Desig and will only
> interpret LaTeX/TeX "primary" commands.  Maybe there is a possibility to
> give some TeX/LaTeX code to MathJax?  In addition, when outputting html,
> @tex blocks are ignored.

If we could get Texinfo macros (with @macro) working inside @displaymath
blocks these could be used instead.  Then the macro expansion would be
done before MathJax processes the file, so there would no issue with scope.

In another you had the following:

@tex
\def\Exp{\mathop{\rm exp}}
\def\Mod#1{\left| #1 \right|}
\def\Expf#1{\Exp \left[ #1 \right]}
\def\Angf{\omega = 2 \pi \nu}
\def\Gm{\gamma}

\vskip 0.3cm
$\underline{\bf Gaussian\; Function}$

$$ W^G_t(t',\nu)
   = {\Mod{\nu} \over \sqrt{2 \pi}}\; \Expf{-\nu^2 (t-t')^2 \over 2} $$

$$ W^G_t(t',\omega)
   = {1 \over 2 \pi} {\left| \omega \right| \over \sqrt{2 \pi}}\;
  {\rm exp} \left[ {-\omega^2 (t-t')^2 \over 8 \pi^2} \right]
  \,,\quad  \Angf
$$
@end tex

You could change this to:

@macro Exp
\\mathop{\\rm exp}
@end macro

@macro Mod{A}
\\left| \A\ \\right|
@end macro

@macro Expf{A}
\\Exp \\left[ \A\ \\right]
@end macro

@macro Angf
\\omega = 2 \\pi \\nu
@end macro

@macro Gm
\\Gm
@end mao

@subsubheading Gaussian Function

@displaymath
\displaylines{
W^G_t(t',\nu)
   = {@Mod{\nu} \over \sqrt{2 \pi}}\; @Expf{-\nu^2 (t-t')^2 \over 2}\cr
W^G_t(t',\omega)
   = {1 \over 2 \pi} {\left| \omega \right| \over \sqrt{2 \pi}}\;
  {\rm exp} \left[ {-\omega^2 (t-t')^2 \over 8 \pi^2} \right]
  \,,\quad  @Angf\cr
}
@end displaymath

This works perfectly with TeX as far as I can see, but unfortunately
not with texi2any at present.  This could be changed to make
@displaymath more like @example, where Texinfo commands are interpreted,
and less like @verbatim where they are not.



reply via email to

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