ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to typeset differential (math)?
@ 2015-06-17 12:00 Procházka Lukáš Ing. - Pontex s. r. o.
  2015-06-17 12:50 ` Manuel Blanco
  0 siblings, 1 reply; 6+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2015-06-17 12:00 UTC (permalink / raw)
  To: ConTeXt

[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]

Hello,

how to typeset differential in math correctly?

Here are my attempts:

----
\definemathcommand[dif][nolop]{\mfunction{d}} % Based on http://wiki.contextgarden.net/Math/functions

\starttext
   \startformula
     \sin x {\tf d} x
   \stopformula

   \startformula
     \sin x \dif x
   \stopformula
\stoptext
----

But:

- case 1: there is no space between "d" and "x" (should be similar to that between "sin" and "x")

- case 2: "d" in the formula is shifted down (?!) somehow.

So - ?

Other questions:

I need to typeset some math text.

- Variables should be typeset slanted, which is OK (see "x" in the example).

- Functions (sin, log... "d" in df/dx) should be typeset non-slanted - I guess \definemathcommand is supposed for this (or is there a better way?).

- Vector variables should be typeset bold slanted - is there a special command for this? (\vec adds arrow above the expression, so it is not supposed for this).

Thank you in advance.

Best regards,

Lukas


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751
Fax: +420 244 461 038

[-- Attachment #2: dif.mkiv --]
[-- Type: application/octet-stream, Size: 181 bytes --]

\definemathcommand[dif][nolop]{\mfunction{d}}

\starttext
  \startformula
    \sin x {\tf d} x
  \stopformula

  \startformula
    \sin x \dif x
  \stopformula
\stoptext

[-- Attachment #3: dif.pdf --]
[-- Type: application/pdf, Size: 6429 bytes --]

[-- Attachment #4: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to typeset differential (math)?
  2015-06-17 12:00 How to typeset differential (math)? Procházka Lukáš Ing. - Pontex s. r. o.
@ 2015-06-17 12:50 ` Manuel Blanco
  2015-06-17 13:55   ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 1 reply; 6+ messages in thread
From: Manuel Blanco @ 2015-06-17 12:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

The most common definition is

    \define\dif{\mathop{}\!\mfunction{d}}

(I don't know enough of ConTeXt, so may be {\tf d}  is better than
\mfunction{d}).

The important part is \mathop{}\! which will add the space on the left
automatically when it's needed (for instance in \frac{\dif x}{\dif y}
no space is added).

2015-06-17 14:00 GMT+02:00 Procházka Lukáš Ing. - Pontex s. r. o.
<LPr@pontex.cz>:
> Hello,
>
> how to typeset differential in math correctly?
>
> Here are my attempts:
>
> ----
> \definemathcommand[dif][nolop]{\mfunction{d}} % Based on
> http://wiki.contextgarden.net/Math/functions
>
> \starttext
>   \startformula
>     \sin x {\tf d} x
>   \stopformula
>
>   \startformula
>     \sin x \dif x
>   \stopformula
> \stoptext
> ----
>
> But:
>
> - case 1: there is no space between "d" and "x" (should be similar to that
> between "sin" and "x")
>
> - case 2: "d" in the formula is shifted down (?!) somehow.
>
> So - ?
>
> Other questions:
>
> I need to typeset some math text.
>
> - Variables should be typeset slanted, which is OK (see "x" in the example).
>
> - Functions (sin, log... "d" in df/dx) should be typeset non-slanted - I
> guess \definemathcommand is supposed for this (or is there a better way?).
>
> - Vector variables should be typeset bold slanted - is there a special
> command for this? (\vec adds arrow above the expression, so it is not
> supposed for this).
>
> Thank you in advance.
>
> Best regards,
>
> Lukas
>
>
> --
> Ing. Lukáš Procházka | mailto:LPr@pontex.cz
> Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz
> Bezová 1658
> 147 14 Praha 4
>
> Tel: +420 241 096 751
> Fax: +420 244 461 038
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to typeset differential (math)?
  2015-06-17 12:50 ` Manuel Blanco
@ 2015-06-17 13:55   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2015-06-17 14:23     ` Manuel Blanco
  2015-06-17 14:25     ` Aditya Mahajan
  0 siblings, 2 replies; 6+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2015-06-17 13:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

thanks for the solution: \define\dif{\mathop{}\!\mfunction{d}}

Some explanation for \mathop and \mfunction would be appreciated,
and also explanation why \definemathcommand[dif][nolop]{\mfunction{d}} didn't work...

But it is not urgent, just for perfection...

Best regards,

Lukas


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751
Fax: +420 244 461 038

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to typeset differential (math)?
  2015-06-17 13:55   ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2015-06-17 14:23     ` Manuel Blanco
  2015-06-17 14:35       ` Procházka Lukáš Ing. - Pontex s. r. o.
  2015-06-17 14:25     ` Aditya Mahajan
  1 sibling, 1 reply; 6+ messages in thread
From: Manuel Blanco @ 2015-06-17 14:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

The easy way to answer that:
\definemathcommand[dif][nolop]{\mfunction{d}} didn't work because it's
intended for log-like functions, and you don't want a log-like
function, but a differential, which behaves differently (for instance,
you *want* space between the function and the argument in `\sin x \cos
y` but you *don't want* spaces between the “d” and the variable in
`\dif x \dif y`).

About `\mfunction` I don't know, I think what's in the wiki is enough,
it's the command that sets the font used for other upright functions
(notice that some people prefer italic differentials hence the
definition would be \define\dif{\mathop{}\!d}).

And about how does that work, well, basically what you want is a thin
space added on the left, but not on the right, so \mathop{} gives a
thin space on both sides, then with \! you remove the thin space on
the right and you then leave the \mfunction{d} with normal spacing.

That definition behaves correctly in every case (except if you use
“physics-like” notation where the differential comes just after \int).

I hope I don't leave anything relevant out (but I'm no expert).
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to typeset differential (math)?
  2015-06-17 13:55   ` Procházka Lukáš Ing. - Pontex s. r. o.
  2015-06-17 14:23     ` Manuel Blanco
@ 2015-06-17 14:25     ` Aditya Mahajan
  1 sibling, 0 replies; 6+ messages in thread
From: Aditya Mahajan @ 2015-06-17 14:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 914 bytes --]

On Wed, 17 Jun 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:

> Hello,
>
> thanks for the solution: \define\dif{\mathop{}\!\mfunction{d}}

Another alternative is (untested)

\definemathcommand[dif][nolop]{\mfunction{d}\kern\zeropoint}

> Some explanation for \mathop and \mfunction would be appreciated,
> and also explanation why \definemathcommand[dif][nolop]{\mfunction{d}} didn't 
> work...

Roughtly, the above exapnds to

\define\dif{\mathop{\mfunction{d}}\nolimits}

When the argument of \mathop is a single character (d, in this case), 
mathop centers the charater on the 'math-axis'. The rationale is that such 
a behavior is desirable when defining single letter math operators such as 
sum, int, bigcap, bigcup, etc. Adding \kern\zeropoint makes TeX think that 
the argument of \mathop is more than a single character, so it does not 
center d along the math-axis.

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to typeset differential (math)?
  2015-06-17 14:23     ` Manuel Blanco
@ 2015-06-17 14:35       ` Procházka Lukáš Ing. - Pontex s. r. o.
  0 siblings, 0 replies; 6+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2015-06-17 14:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

On Wed, 17 Jun 2015 16:23:01 +0200, Manuel Blanco <manuelbl@ucm.es> wrote:

> The easy way to answer that:
> \definemathcommand[dif][nolop]{\mfunction{d}} didn't work because it's
> intended for log-like functions, and you don't want a log-like
> function, but a differential, which behaves differently (for instance,
> you *want* space between the function and the argument in `\sin x \cos
> y` but you *don't want* spaces between the “d” and the variable in
> `\dif x \dif y`).
>
> About `\mfunction` I don't know, I think what's in the wiki is enough,
> it's the command that sets the font used for other upright functions
> (notice that some people prefer italic differentials hence the
> definition would be \define\dif{\mathop{}\!d}).
>
> And about how does that work, well, basically what you want is a thin
> space added on the left, but not on the right, so \mathop{} gives a
> thin space on both sides, then with \! you remove the thin space on
> the right and you then leave the \mfunction{d} with normal spacing.
>
> That definition behaves correctly in every case (except if you use
> “physics-like” notation where the differential comes just after \int).
>
> I hope I don't leave anything relevant out (but I'm no expert).

... thank you for deep explanation!

Lukas


-- 
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o.      | mailto:pontex@pontex.cz | http://www.pontex.cz
Bezová 1658
147 14 Praha 4

Tel: +420 241 096 751
Fax: +420 244 461 038

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-17 14:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-17 12:00 How to typeset differential (math)? Procházka Lukáš Ing. - Pontex s. r. o.
2015-06-17 12:50 ` Manuel Blanco
2015-06-17 13:55   ` Procházka Lukáš Ing. - Pontex s. r. o.
2015-06-17 14:23     ` Manuel Blanco
2015-06-17 14:35       ` Procházka Lukáš Ing. - Pontex s. r. o.
2015-06-17 14:25     ` Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).