Re: [NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Mikael P. Sundqvist
Hi,

this is what I learned from the list to use. I'm sorry, but the names
sound a bit Swedish, but I'm sure you can change that. This way it was
also easy to add different types like hints, answers and solutions and
get clickable letters accordingly.

/Mikael

%Test file
\setupinteraction[state=start,color=,contrastcolor=,style=]

\define[1]\problemtextmakro
 {%
  \doifreferencefoundelse{losn:\currentconstructionreference}
 {\llap{\goto{{\WORD l}}[losn:\currentconstructionreference]}\,}
 {}%
  #1
  }

\defineenumeration[problem][
referenceprefix=problem,
text=,
width=fit,
numbercommand=\problemtextmakro,
number=yes,
alternative=serried,
hang=margin,
indentnext=auto,
indenting={yes,small},
prefix=yes,
prefixsegments=chapter,
way=bychapter,
]


\defineblock[losn]
\hideblocks[losn]


\define[1]\losntextmakro
  {\doifreferencefoundelse{problem:\currentconstructionreference}
 {\bf 
\goto{\WORD{\in[problem:\currentconstructionreference]}}[problem:\currentconstructionreference]}
 {}
  }


\defineenumeration[losning][
referenceprefix=losn,
numbercommand=\losntextmakro,
text=,
headstyle=,
title=yes,
titlestyle=,
alternative=serried,
width=fit,
number=no,
indentnext=auto,
indenting={yes,medium},
before={\blank[halfline]},
after={\blank[halfline]},
]



\starttext

\chapter{Problems}

\startproblem[p:cont]
Show that all functions are continuous.
\stopproblem

\beginlosn
\startlosning[p:cont]
All functions are continuous\ldots
\stoplosning
\endlosn

\startproblem
This is a problem without solution
\stopproblem

\startproblem[p:diff]
Show that all functions are differentiable.
\stopproblem

\beginlosn
\startlosning[p:diff]
All functions are differentiable\ldots
\stoplosning
\endlosn


\beginlosn
\startlosning[p:diff]
This is a second solution to~\in[p:diff].\ldots
\stoplosning
\endlosn

\chapter{Solutions}

\selectblocks[losn][criterium=all]

On Fri, Feb 1, 2019 at 5:20 AM Alan Braslau  wrote:
>
> On Thu, 31 Jan 2019 22:10:40 -0500
> Sanjoy Mahajan  wrote:
>
> > Thank you, Matthias and Wolfgang, for the examples/solutions.
>
> Why not use the list mechanism?
>
> Alan
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Alan Braslau
On Thu, 31 Jan 2019 22:10:40 -0500
Sanjoy Mahajan  wrote:

> Thank you, Matthias and Wolfgang, for the examples/solutions.

Why not use the list mechanism?

Alan
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Sanjoy Mahajan
Thank you, Matthias and Wolfgang, for the examples/solutions.

If I understand them right, there must be one solution for each exercise
(otherwise the solution numbering gets out of sync).  Or do the
coupling= options in Matthias's example remove that restriction?  In my
experiments with the examples, deleting the first solution
unsynchronized the exercise--solution numbering, no matter how I fiddled
with the coupling keys.

In the ideal pedagogical world, I'd write a solution for each exercise.
But reality might intervene, so I still wonder if the solutions can
automatically know and include the exercise number (perhaps by placing
\startanswer..\stopanswer inside \startexercise..\stopexercise and using
\getnumber[exercise]).  If there is a clever way, that's great.  But,
the nature of TeX as a macro language may preclude the \getnumber code
being evaluated just when one wants.

Regards,
-Sanjoy
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Weber, Matthias
A while back I asked a similar question, and Hans pointed out the following 
which I still use:

\defineenumeration
 [exercise]
 [way=bysection,
  text=Exercise,
  coupling=solution,
  location=hanging]

\defineenumeration
 [solution]
 [text=Solution,
  way=bysection,
  coupling=exercise,
  location=hanging]

\defineblock[exercise]
\defineblock[solution]
\hideblocks[solution]

\setupinteraction
 [state=start]

\starttext

\section{Main Text}

\subsection[subsec:1]{problem section 1}

\startexercise
Addition\index{addition} problem: $1+1=?$ 
\stopexercise

\beginsolution[one]
\startsolution
Answer: 2. 
\stopsolution
\endsolution

\subsection[subsec:2]{problem section 2}

\startexercise
Multiplication problem: $1\times1=?$
\stopexercise

\beginsolution[two]
\startsolution
Answer: 1.
\stopsolution
\endsolution

\page

%\reset[solution]

\section{Answers to the Problems}

\subsection{Answers to \in{section}[subsec:1]}

\useblocks[solution][one]

\subsection{Answers to \in{section}[subsec:2]}

\useblocks[solution][two]

\stoptext


> On Jan 31, 2019, at 5:02 PM, Wolfgang Schuster 
>  wrote:
> 
> Hi Sanjoy,
> 
> when you have a equal number of questions ans answers you can create a 
> enumeration for each and collect the answers with the block mechanism.
> 
> At the end of the document you can flush the collected answers.
> 
> \defineblock [answer]
> 
> \defineenumeration [question]
> \defineenumeration [answer]
> 
> \starttext
> 
> \startquestion
> Question 1
> \stopquestion
> 
> \beginanswer
> \startanswer
> Answer 1
> \stopanswer
> \endanswer
> 
> \startquestion
> Question 2
> \stopquestion
> 
> \beginanswer
> \startanswer
> Answer 2
> \stopanswer
> \endanswer
> 
> \page
> 
> \useblocks[answer]
> 
> \stoptext
> 
> Wolfgang
> 
> 
> Sanjoy Mahajan schrieb am 31.01.19 um 22:51:
>> Dear List,
>> I'm trying to have problem solutions automatically collected, each with
>> its corresponding problem number, e.g. 2.3, and then typeset at the end
>> of a document.  Thus, I imagine something like
>> \startproblem{A problem title}  % Problem 1.1
>> A question
>> \startsolution
>> An answer
>> \stopsolution
>> \stopproblem
>> And then the solution(s) would appear at the end (with the "1.1"
>> remembered from when the problem was typeset):
>>   Solution to Problem 1.1.
>>   An answer
>> It seems that buffers are the way to do this.  But I cannot quite get
>> the automatic numbering to work.  The delayed evaluation and information
>> passing between lua and ConTeXt has me confused and tangled in a knot.
>> Below is a minimal almost-working example.  The issue is in the line
>>   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
>> which ends up putting the verbatim string "\getnumber[problem]" into the
>> temp buffer, rather than the typeset result, which would be something
>> like 1.1 or 1.2.
>> I've read the cld-mkiv.pdf manual, but I must be missing a simple
>> solution to getting ConTeXt to send back the result of
>> \getnumber[problem].  I've also tried the analogous
>> context.getnumber({"problem"}), though without success.
>> Does anyone see what I am missing?
>> Many thanks!
>> -Sanjoy
>> \defineenumeration[problem]
>>   [title=yes, text=Problem, way=bychapter, prefix=chapter]
>> \defineenumeration[solution][problem]
>> \setupenumeration [solution][text={Solution to problem}, number=no]
>> \def\test#1{[#1]}
>> % appendbuffer modified from Sietse Brouwer's on mailing list (Jan 15, 2013)
>> \startluacode
>> userdata = userdata or { }
>> function userdata.addTempToBuffer(buffername, problem)
>> buffers.append(
>> buffername,
>> '\\startsolution{' .. problem .. '}\n' .. 
>> buffers.getcontent('APPENDTEMP') .. '\n\\stopsolution\n\n'
>> )
>> end
>> \stopluacode
>> \def\startappendbuffer[#1]%
>>   {\def\stopappendbuffer%
>>   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
>>\dostartbuffer[APPENDTEMP][startappendbuffer][stopappendbuffer]}
>> \starttext
>> \chapter{One}
>> \startproblem{Test}
>>   Test problem
>> \startappendbuffer[soln]
>> Solution
>> \stopappendbuffer
>> \stopproblem
>> \startproblem{Test}
>> Test problem
>> \startappendbuffer[soln]
>> Solution
>> \stopappendbuffer
>> \stopproblem
>> \typebuffer[soln]
>> \stoptext
>> ___
>> 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://context.aanhet.net
>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>> wiki : http://contextgarden.net
>> ___
> ___
> If your question is of interest to others as well, please add an entry to 

Re: [NTG-context] Headings vs. enumerations

2019-01-31 Thread Wolfgang Schuster

Clyde Johnston schrieb am 31.01.19 um 21:07:


I have a document that contains a numbered enumeration that spans 107 
pages – it’s a legal document where \items are clauses.  I would like 
to put level one of the enumeration in a table of contents.


I have read the available documentation but I am not clear whether I 
should make level one headers, whether I can utilise the \starthead in 
\startitemize or whether I can create a list from the level one 
headings to create the table of contents.


How is best to tackle this problem?



The best solution is to use real headers and drop the enumerations.

You can hide disable parts (e.g. the chapter number) of the section 
counter to get the same results as you have with your current solution.


Wolfgang

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Wolfgang Schuster

Hi Sanjoy,

when you have a equal number of questions ans answers you can create a 
enumeration for each and collect the answers with the block mechanism.


At the end of the document you can flush the collected answers.

\defineblock [answer]

\defineenumeration [question]
\defineenumeration [answer]

\starttext

\startquestion
Question 1
\stopquestion

\beginanswer
\startanswer
Answer 1
\stopanswer
\endanswer

\startquestion
Question 2
\stopquestion

\beginanswer
\startanswer
Answer 2
\stopanswer
\endanswer

\page

\useblocks[answer]

\stoptext

Wolfgang


Sanjoy Mahajan schrieb am 31.01.19 um 22:51:

Dear List,

I'm trying to have problem solutions automatically collected, each with
its corresponding problem number, e.g. 2.3, and then typeset at the end
of a document.  Thus, I imagine something like

\startproblem{A problem title}  % Problem 1.1
A question

\startsolution
An answer
\stopsolution

\stopproblem

And then the solution(s) would appear at the end (with the "1.1"
remembered from when the problem was typeset):

   Solution to Problem 1.1.

   An answer

It seems that buffers are the way to do this.  But I cannot quite get
the automatic numbering to work.  The delayed evaluation and information
passing between lua and ConTeXt has me confused and tangled in a knot.

Below is a minimal almost-working example.  The issue is in the line

   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}

which ends up putting the verbatim string "\getnumber[problem]" into the
temp buffer, rather than the typeset result, which would be something
like 1.1 or 1.2.

I've read the cld-mkiv.pdf manual, but I must be missing a simple
solution to getting ConTeXt to send back the result of
\getnumber[problem].  I've also tried the analogous
context.getnumber({"problem"}), though without success.

Does anyone see what I am missing?

Many thanks!

-Sanjoy

\defineenumeration[problem]
   [title=yes, text=Problem, way=bychapter, prefix=chapter]
\defineenumeration[solution][problem]
\setupenumeration [solution][text={Solution to problem}, number=no]

\def\test#1{[#1]}

% appendbuffer modified from Sietse Brouwer's on mailing list (Jan 15, 2013)
\startluacode
 userdata = userdata or { }
 function userdata.addTempToBuffer(buffername, problem)
 buffers.append(
 buffername,
 '\\startsolution{' .. problem .. '}\n' .. 
buffers.getcontent('APPENDTEMP') .. '\n\\stopsolution\n\n'
 )
 end
\stopluacode

\def\startappendbuffer[#1]%
   {\def\stopappendbuffer%
   {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
\dostartbuffer[APPENDTEMP][startappendbuffer][stopappendbuffer]}

\starttext

\chapter{One}

\startproblem{Test}
   Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\startproblem{Test}
Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\typebuffer[soln]

\stoptext
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] getting ConTeXt results back to Lua (for typesetting solutions at end of document)

2019-01-31 Thread Sanjoy Mahajan
Dear List,

I'm trying to have problem solutions automatically collected, each with
its corresponding problem number, e.g. 2.3, and then typeset at the end
of a document.  Thus, I imagine something like

\startproblem{A problem title}  % Problem 1.1
A question

\startsolution
An answer
\stopsolution

\stopproblem

And then the solution(s) would appear at the end (with the "1.1"
remembered from when the problem was typeset):

  Solution to Problem 1.1.

  An answer

It seems that buffers are the way to do this.  But I cannot quite get
the automatic numbering to work.  The delayed evaluation and information
passing between lua and ConTeXt has me confused and tangled in a knot.

Below is a minimal almost-working example.  The issue is in the line

  {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}

which ends up putting the verbatim string "\getnumber[problem]" into the
temp buffer, rather than the typeset result, which would be something
like 1.1 or 1.2.

I've read the cld-mkiv.pdf manual, but I must be missing a simple
solution to getting ConTeXt to send back the result of
\getnumber[problem].  I've also tried the analogous
context.getnumber({"problem"}), though without success.

Does anyone see what I am missing?

Many thanks!

-Sanjoy

\defineenumeration[problem]
  [title=yes, text=Problem, way=bychapter, prefix=chapter]
\defineenumeration[solution][problem]
\setupenumeration [solution][text={Solution to problem}, number=no]

\def\test#1{[#1]}

% appendbuffer modified from Sietse Brouwer's on mailing list (Jan 15, 2013)
\startluacode
userdata = userdata or { }
function userdata.addTempToBuffer(buffername, problem)
buffers.append(
buffername,
'\\startsolution{' .. problem .. '}\n' .. 
buffers.getcontent('APPENDTEMP') .. '\n\\stopsolution\n\n'
)
end
\stopluacode

\def\startappendbuffer[#1]%
  {\def\stopappendbuffer%
  {\ctxlua{userdata.addTempToBuffer('#1', [==[\getnumber[problem]]==])}}
   \dostartbuffer[APPENDTEMP][startappendbuffer][stopappendbuffer]}

\starttext

\chapter{One}

\startproblem{Test}
  Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\startproblem{Test}
Test problem
\startappendbuffer[soln]
Solution
\stopappendbuffer
\stopproblem

\typebuffer[soln]

\stoptext
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] New logo proposal

2019-01-31 Thread Henri Menke
Dear Paul,

Personally I really like your logo design, but there is one thing that
bothers me a lot, which is the non-free font.  Could it perhaps be
replaced by a free font, e.g. Fetamont?
https://www.ctan.org/pkg/fetamont

Cheers, Henri

On 29/01/19 12:18 PM, Paul Schalck wrote:
> Dear ConTeXt users and developers,
> 
> I want to submit a new ConTeXt logo to you (link to GitLab project):
> 
> https://gitlab.com/schickele/new-context-logo
> 
> I made this logo in February 2018. At the time, I was planning to do some 
> video tutorials on ConTeXt (still work in progress), and I wanted a nice 
> looking visual clue for the thumbnails. Recently, I made a few minor tweaks 
> and thought it would be the right time to put it out there.
> 
> The logo comes in two different layouts (hexagonal and horizontal), and each 
> layout comes in two color variations (multicolored and blue).
> 
> The hexagonal layout is borrowed from the unofficial ConTeXt logo that has 
> been around for some time. I like the idea of a clean geometrical form, and 
> the hexagon reminds me of chemistry formulas -- one of the many application 
> fields of ConTeXt.
> 
> The seven colors have mainly an esthetic purpose. They also denote the 
> flexibility of ConTeXt. I've added a monochromatic blue version because 
> shiny, saturated colors are not suitable for every case, and blue is strongly 
> associated with ConTeXt to me. Blue is also a reminder of Mark IV and LuaTeX.
> 
> The letters are set in Din17 EF, which I've licensed. I like its simple 
> shapes combined with a round and soft touch. It avoids consciously the very 
> connoted Computer Modern and can be seen as a modernized and also 
> Europeanized interpretation of the TeX tradition.
> 
> This logo is just a humble proposal. Perhaps it is of some use to someone. It 
> could also make someone else want to create and share his or her logo -- that 
> would be great.
> 
> I'm using ConTeXt since 2006/07 for almost everything that contains text: 
> letters, presentations, invitations, résumés, certificates, manuals, reports, 
> flyers, university papers, book typesetting, exercise sheets, song sheets, 
> and I'm still amazed by how powerful, flexible and reliable it is. Thanks to 
> the whole community -- and particularly to the Dutch wizard -- for making 
> this possible!
> 
> Greetings from Leimen, Germany
> 
> Paul Schalck
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Headings vs. enumerations

2019-01-31 Thread Clyde Johnston
I have a document that contains a numbered enumeration that spans 107 pages
- it's a legal document where \items are clauses.  I would like to put level
one of the enumeration in a table of contents.

 

I have read the available documentation but I am not clear whether I should
make level one headers, whether I can utilise the \starthead in
\startitemize or whether I can create a list from the level one headings to
create the table of contents.

 

How is best to tackle this problem?

 

Thanks,

Clyde

 

MWE #1:

 

\starttext

\placecontent[alternative=c]

 

\startitemize[n,repeat]

\starthead{A heading}\stophead

 

\startitemize[n,repeat,2*broad]

\starthead{A sub-heading}\stophead

\startitemize[n,repeat,3*broad]

\item \input knuth

\stopitemize

\stopitemize

\stoptext

 

MWE #2:

 

\starttext

\placecontent[alternative=c]

 

\chapter{A heading}

 

\startitemize[n,repeat,2*broad]

\starthead{A sub-heading}\stophead

\startitemize[n,repeat,3*broad]

\item \input knuth

\stopitemize

\stopitemize

\stoptext

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Hans Åberg

> On 31 Jan 2019, at 15:00, Clyde Johnston  wrote:
> 
> Maybe this should be a language specific parameter.  How would you achieve a 
> similar result with the Indian numbering system, for instance?

It is an additional feature that may or may not be linked to language. For 
example, in Swedish originally, the comma and stop are reversed relative 
English, but in modern times, a stop for decimal point might be used. To avoid 
confusion between commas and stops as decimal points there is an recommendation 
admitting both, using spaces as separators. And in India, they might prefer 
digit groups of two instead of three.

> Also, decimal and thousands separators vary from country to country.  In 
> France, for example, they use the comma for the decimal separator, and space 
> for the thousand separator. 


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Clyde Johnston
Maybe this should be a language specific parameter.  How would you achieve a
similar result with the Indian numbering system
 , for instance?

 

Also, decimal and thousands separators vary from country to country.  In
France, for example, they use the comma for the decimal separator, and space
for the thousand separator.

 

Clyde

 

 

From: ntg-context [mailto:ntg-context-boun...@ntg.nl] On Behalf Of Otared
Kavian
Sent: Thursday, January 31, 2019 2:43 PM
To: mailing list for ConTeXt users
Subject: Re: [NTG-context] Automatic thousands separation in \unit

 

Hi Marco,

 

Can this give what you wish?

 

\define[2]\myunit{\spaceddigits{#1}\unit{#2}}

\starttext 

\myunit{123456789}{volt}

\stoptext

 





On 31 Jan 2019, at 13:28, Marco Patzer  wrote:

 

Hi!

I'm wondering if there's a way to have automatic thousands separation in the
\unit command? \spaceddigits does that, but it doesn't work inside \unit.
And
using both would be quite verbose to write. Example:

\starttext
 %% no thousands separation
 \unit{123456789 volt}

 %% manual thousands separation works
 \unit{123,456,789 volt}

 %% automatic thousands separation, but not using \unit
 \let\spaceddigitsseparator,
 \spaceddigits{123456789}\,V

 %% fails, no output
 \unit{\spaceddigits{123456789} volt}
\stoptext

Marco

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Otared Kavian
Hi Marco,

Can this give what you wish?

\define[2]\myunit{\spaceddigits{#1}\unit{#2}}
\starttext 
\myunit{123456789}{volt}
\stoptext


> On 31 Jan 2019, at 13:28, Marco Patzer  wrote:
> 
> Hi!
> 
> I'm wondering if there's a way to have automatic thousands separation in the
> \unit command? \spaceddigits does that, but it doesn't work inside \unit. And
> using both would be quite verbose to write. Example:
> 
> \starttext
>  %% no thousands separation
>  \unit{123456789 volt}
> 
>  %% manual thousands separation works
>  \unit{123,456,789 volt}
> 
>  %% automatic thousands separation, but not using \unit
>  \let\spaceddigitsseparator,
>  \spaceddigits{123456789}\,V
> 
>  %% fails, no output
>  \unit{\spaceddigits{123456789} volt}
> \stoptext
> 
> Marco
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Automatic thousands separation in \unit

2019-01-31 Thread Marco Patzer
Hi!

I'm wondering if there's a way to have automatic thousands separation in the
\unit command? \spaceddigits does that, but it doesn't work inside \unit. And
using both would be quite verbose to write. Example:

\starttext
  %% no thousands separation
  \unit{123456789 volt}

  %% manual thousands separation works
  \unit{123,456,789 volt}

  %% automatic thousands separation, but not using \unit
  \let\spaceddigitsseparator,
  \spaceddigits{123456789}\,V

  %% fails, no output
  \unit{\spaceddigits{123456789} volt}
\stoptext

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___