A few question about defining symbols and creating downarrow to illustrate function rules
Hello, I have a few questions. 1. What is the best way to get a symbol from a font you are not using as your main? %% start MWE \starttext \definesymbol[cedis][\utfchar{“20B5}] \def\cedis{ \switchtobodyfont[dejavu]\tf\symbol[cedis] } I have GH\cedis 10.00 in my pocket \stoptext %% end MWE I tried to use \getglyph because I saw it being used in a similar way (but not with unicode characters) like this: \definesymbol[cedis][\getglyph{dejavu}{\utfchar{"20B5}}] It didn't work. 2. I would like a more robust method to create a diagram (ie., a series of input and outputs where you are then required to tell the rule of the mapping). The inputs will be up with the outputs below and a downward pointing arrow between them. %% start MWE \starttext \define[2]\xdownarrow{ \startframed[frame=off,offset=0pt,width=0.8cm] \startMPcode numeric u, w; u := .3cm; w := 2pt; pair pointX, pointY; path pointXY; pointX := origin; pointY := pointX shifted (0,-3u); draw pointX -- pointY withpen pencircle scaled .6w; drawarrow pointX -- pointY withpen pencircle scaled .6w; labeloffset := u; label.top (textext("\dm{#1}"), pointX); label.bot (textext("\dm{ #2 }"), pointY); \stopMPcode \stopframed } \startitemize[n] \item Find the rule of the mapping: \startplacefigure[location=none] \startframed[frame=off,offset=0pt,] \xdownarrow{x}{y} \hspace[big] \xdownarrow{1}{3} \hspace[big] \xdownarrow{2}{1} \hspace[big] \xdownarrow{3}{-1} \hspace[big] \xdownarrow{4}{-3} \hspace[big] \xdownarrow{5}{-5} \stopframed \stopplacefigure \startitemize[a] \item \im{y = 2x + 2} \item \im{y = -2x + 2} \item \im{y = 4x} \item \im{y = -2x + 5} \stopitemize \stopitemize %% stop MWR How can I achieve this more elegantly with better spacing and the arrow pointing to the number instead (-) for negative numbers? Regards, Jethro
Am 24.11.24 um 19:08 schrieb Jethro Djan:
Hello,
I have a few questions.
1. What is the best way to get a symbol from a font you are not using as your main?
e.g. \definefontsynonym [MySymFont] [file:MySymFont.ttf] \definesymbol[cedis][\getglyphstyled{MySymFont}{\tochar{x:20B5}}] \def\cedis{\symbol[cedis]} or just \def\cedis{{\definedfont[MySymFont*default]\tochar{x:20B5}}}
\definesymbol[cedis][\utfchar{“20B5}] \def\cedis{ \switchtobodyfont[dejavu]\tf\symbol[cedis] }
I have GH\cedis 10.00 in my pocket
Don’t use \switchtobodyfont for a single character. For such cases, a fallback font is probably better. \definefontfallback [symbolfallback] [name:MySymFont] [0x20B5]% can also be a list or range [check=yes,force=no] \definetypeface [MyMainFamily] [rm] [serif] [palatino] [default][fallbacks=symbolfallback] https://wiki.contextgarden.net/Command/definefontfallback
2. I would like a more robust method to create a diagram (ie., a series of input and outputs where you are then required to tell the rule of the mapping). The inputs will be up with the outputs below and a downward pointing arrow between them.
Sorry, can’t help you here. Better don’t mix different subjects in one message. Hraban
On Sun, 24 Nov 2024 21:06:23 +0100
Henning Hraban Ramm
2. I would like a more robust method to create a diagram (ie., a series of input and outputs where you are then required to tell the rule of the mapping). The inputs will be up with the outputs below and a downward pointing arrow between them.
Sorry, can’t help you here. Better don’t mix different subjects in one message.
Yes, easier on everyone to keep issues separate. You may want to look into either the flowchart module: tex/texmf-context/doc/context/documents/general/manuals/charts-mkiv.pdf or the nodes module: tex/texmf-context/doc/context/documents/general/manuals/nodes.pdf Alan
Didn’t know some of these stuff existed. The caution to separate issues when asking questions is also heard. Many thanks to Hraban and Alan for your solutions. Jethro On Sun, 24 Nov 2024 at 9:52 PM, Alan Braslau via ntg-context < ntg-context@ntg.nl> wrote:
On Sun, 24 Nov 2024 21:06:23 +0100 Henning Hraban Ramm
wrote: 2. I would like a more robust method to create a diagram (ie., a series of input and outputs where you are then required to tell the rule of the mapping). The inputs will be up with the outputs below and a downward pointing arrow between them.
Sorry, can’t help you here. Better don’t mix different subjects in one message.
Yes, easier on everyone to keep issues separate.
You may want to look into either the flowchart module: tex/texmf-context/doc/context/documents/general/manuals/charts-mkiv.pdf or the nodes module: tex/texmf-context/doc/context/documents/general/manuals/nodes.pdf
Alan
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
Am 25.11.24 um 07:01 schrieb Jethro Djan:
Didn’t know some of these stuff existed.
That happens even to old hands. Hans himself sometimes forgets what’s in ConTeXt ;)
Many thanks to Hraban and Alan for your solutions.
You’re welcome. Hraban
participants (3)
-
Alan Braslau
-
Henning Hraban Ramm
-
Jethro Djan