Re: [NTG-context] checking mainlanguage setup

2011-06-01 Thread Jeong Dalyoung
Dear Aditya,


 
 context([[\def\noexpand\Lang{...}]])

not working
 
 or
 
 context([[\def\string\Lang{...}]])

working

 
 I don't understand why
 
 context([[\def\\Lang{...}]])
working, too


You are right. [[\def\\Lang{English}]] method works.

I summerize it as a test file. The first 5 methods are working well, but the 
last one using \noexpand cause the error.

Thank you.

Best regards,

Dalyoung

\mainlanguage[en]
\starttext
\startitemize[n]
\head Using \type{context.setvalue(Lang,English)}

\startluacode
if languages.current() == en then
  context.setvalue(Lang,English)
else
  context.setvalue(Lang,Not English)
end
\stopluacode
Current language: \Lang

\head Using \type{context(\\def\\Lang{English})}

\startluacode
if languages.current() == en then
  context(\\def\\Lang{English})
else
  context(\\def\\Lang{Not English})
end
\stopluacode
Current language: \Lang

\head Using \type{context([[\def\string\Lang{English}]])}

\startluacode
if languages.current() == en then
  context([[\def\string\Lang{English}]])
else
  context([[\def\string\Lang{Not English}]])
end
\stopluacode
Current language: \Lang

\head Using \type{context([[\def\\Lang{English}]])}

\startluacode
if languages.current() == en then
  context([[\def\\Lang{English}]])
else
  context([[\def\\Lang{Not English}]])
end
\stopluacode
Current language: \Lang

\head Using \type{\doifelse\currentmainlanguage{en}...}

\doifelse\currentmainlanguage{en}
 {\def\Lang{English}}{\def\Lang{Not English}}
 Current language: \Lang

\head Using \type{context([[\def\noexpand\Lang{English}]])}

%\startluacode
% if languages.current() == en then
% context([[\def\noexpand\Lang{English}]])
% else
% context([[\def\noexpand\Lang{Not English}]])
% end
%\stopluacode
%Current language: \Lang
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] checking mainlanguage setup

2011-06-01 Thread Hans Hagen

On 31-5-2011 4:33, Procházka Lukáš Ing. - Pontex s. r. o. wrote:

On Tue, 31 May 2011 12:45:00 +0200, Jeong Dalyoung hak...@me.com wrote:


Dear Lucas,




Shouldn't it be (untested):

context(\\def\\lang{English})




It is working.



context([[\def\lang{English}]])


It is not working. It prints def lang English.

Thank you.

Best regards,

Dalyoung


OK.

I meant just the way how strings in Lua are entered

- if inside quotation marks, escaping is required, thus \\ yields to
backslash,
- if inside [[ ... ]], single \ gives backslash, and of course \\ gives
TWO backslashes.

I guessed that your original

[[\\def\\lang{English}]]

could have caused the problem, so I corrected it to

[[\def\lang{English}]]


[[ ]] vs   is a lua thing ... but when you pass things from within 
tex, expansions happens the same in both; you can try


context(\detokenize{...})



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-06-01 Thread Hans Hagen

On 1-6-2011 10:14, Hans Hagen wrote:


[[ ]] vs   is a lua thing ... but when you pass things from within
tex, expansions happens the same in both; you can try

context(\detokenize{...})


Sorry, that should have been

\ctxlua{\detokenize{...}}

which takes care of things at the tex end. When at the lua end, you need 
to use \\ (or indeed [[with regular \'s]].


Anyhow, it does not hurt to always to take good look at \'s because 
commands might end up in cycles (or for instance can end up in auxiliary 
files). This is why many commands are defined using \unexpanded.  Even 
if you pass something using context at the lua end. You can see what 
gets passed to tex using:


\enabletrackers[context.trace]

What you see there should look like regular context.

(btw, context.setvalue{Lang,English) also works well and has no 
backslashes)


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-06-01 Thread Wolfgang Schuster

Am 01.06.2011 um 09:45 schrieb Jeong Dalyoung:

 I summerize it as a test file. The first 5 methods are working well, but the 
 last one using \noexpand cause the error.

What exactly do you plan to do with the language check, for simple texts your 
method is overkill and labeltexts are better suited, even a command which 
prints a text can be written in TeX without problems:

\def\LangOne
  {\doifelse{\currentmainlanguage}{en}
 {English 1}
 {\doifelse{\currentmainlanguage}{nl}
{Dutch 1}
{Unknown 1}}}

\def\LangTwo
  {\processaction
 [\currentmainlanguage]
 [ en=English 2,
   nl=Dutch 2,
  unknown=Unknown 2]}

\setuplabeltext[en][langthree=English 3]
\setuplabeltext[nl][langthree=Dutch 3]
\setuplabeltext[langthree=Unknown 3]

\starttext

\LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4]

\mainlanguage[nl]

\LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4]

\mainlanguage[fr]

\LangOne:\LangTwo:\labeltext{langthree}:\translate[en=English 4,nl=Dutch 4]

\stoptext

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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] checking mainlanguage setup

2011-05-31 Thread Procházka Lukáš Ing . - Pontex s . r . o .

On Sat, 28 May 2011 14:26:47 +0200, Jeong Dalyoung hak...@me.com wrote:


context([[\\def\\lang{English}]])


It is not working. It just prints def langEnglish.


BTW, are not there too many backslashes?

Shouldn't it be (untested):

context(\\def\\lang{English})

or

context([[\def\lang{English}]])

Lukas

___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-05-31 Thread Jeong Dalyoung
Dear Lucas,


 
 Shouldn't it be (untested):
 
 context(\\def\\lang{English})
 
 

It is working.

 
 context([[\def\lang{English}]])

It is not working. It prints def lang English.

Thank you.

Best regards,

Dalyoung
___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-05-31 Thread Procházka Lukáš Ing . - Pontex s . r . o .

On Tue, 31 May 2011 12:45:00 +0200, Jeong Dalyoung hak...@me.com wrote:


Dear Lucas,




Shouldn't it be (untested):

context(\\def\\lang{English})




It is working.



context([[\def\lang{English}]])


It is not working. It prints def lang English.

Thank you.

Best regards,

Dalyoung


OK.

I meant just the way how strings in Lua are entered

- if inside quotation marks, escaping is required, thus \\ yields to 
backslash,
- if inside [[ ... ]], single \ gives backslash, and of course \\ gives TWO 
backslashes.

I guessed that your original

[[\\def\\lang{English}]]

could have caused the problem, so I corrected it to

[[\def\lang{English}]]

Cheers,

Lukas


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

Tel: +420 244 062 238
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
___


Re: [NTG-context] checking mainlanguage setup

2011-05-31 Thread Jeong Dalyoung
Dear Lukas,

Thank you for the explanation.

 
 I guessed that your original
 
 [[\\def\\lang{English}]]

No errors message, but it's not working as the way as  I want. It just print 
def langEnglish.

 
 [[\def\lang{English}]]
 

This cause the error message and halt the compiling.

Best regards,

Dalyoung

metapost  loading 'metafun.mp' (experimental metapost version two)
! Undefined control sequence.
system  tex  error on line 84 in file test-font.tex: Undefined control 
sequence ...
74
75
76 \startluacode
77 if languages.current() == kr then
78 -- context.setvalue(lang,한글)
79 context([[\def\lang{한글}]])
80 else
81 -- context.setvalue(lang,English)
82 context(\\def\\lang{English})
83 end
84  \stopluacode
85
86 currentlanguage: \lang
87
88 \section{one.two}
89
90 \doifelse\currentmainlanguage{en}{\def\lang{English}}{\def\lang{영어가 아님}}\par
91
92 currentlanguage: \lang
93 %currentmainlanguage:
94 %\doifelse\currentmainlanguage{kr}{Korean}{Not Korean}\par
\lang #1-\edef \biblanguage
{#1}\ifcsname \??pb \s!language #1\endcsname \l...
argument ...,한글)
context([[\def \lang {
한글}]])
else
-- conte...
\dodostartluacode ...and \directlua \zerocount {#1
}}
l.84 \stopluacode
? 
___
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
___

Re: [NTG-context] checking mainlanguage setup

2011-05-31 Thread Aditya Mahajan

On Wed, 1 Jun 2011, Jeong Dalyoung wrote:


Dear Lukas,

Thank you for the explanation.



I guessed that your original

[[\\def\\lang{English}]]


No errors message, but it's not working as the way as  I want. It just print def 
langEnglish.



[[\def\lang{English}]]



This cause the error message and halt the compiling.


context([[\def\noexpand\Lang{...}]])

or

context([[\def\string\Lang{...}]])

I don't understand why

context([[\def\\Lang{...}]])

does not work. I thought that when TeX code is exapnded inside lua 
environment \\ was equal to \string\.


Aditya

PS: \lang macro is defined by bib module.
___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-05-28 Thread Jeong Dalyoung
Dear Aditya,

Here are the test result.

 context.setvalue(lang, English)

It is working.

 
 
 context([[\\def\\lang{English}]])

It is not working. It just prints def langEnglish.

Now, I got two solutions, using luacode and using \doifelse.

Thank you.

Best regards,

Dalyoung

___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-05-28 Thread Hans Hagen

On 28-5-2011 2:26, Jeong Dalyoung wrote:

Dear Aditya,

Here are the test result.


context.setvalue(lang, English)


It is working.




context([[\\def\\lang{English}]])


It is not working. It just prints def langEnglish.


context.language('en')

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-05-27 Thread Pontus Lurcock
On Fri 27 May 2011, Jeong Dalyoung wrote:

 Is it possible to check what is the mainlanguage set in document?
 Now, I use \enablemode[kr] to do something A. But, I'd like to do it
 automatically if possible.

According to http://wiki.contextgarden.net/Modes#System_modes , 
the mode **kr should be automatically set if kr is the main language
(I haven't tried it, though).

Pont
___
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
___


Re: [NTG-context] checking mainlanguage setup

2011-05-27 Thread Marco
 I'd like to do the following type of setup.
 
 
 if mainlanguage == kr then
 
   do something A
 
 elseif mainlanguage == en then
 
   do something B
 
 else
   do something C
 
 endif

\starttext
\startluacode
  if languages.current() == kr then
context(Something A)
  elseif languages.current() == en then
 context(Something B)
  else
 context(Something C)
  end
\stopluacode
\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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] checking mainlanguage setup

2011-05-27 Thread Peter Münster
On Fri, May 27 2011, Jeong Dalyoung wrote:

 Is it possible to check what is the mainlanguage set in document?

Yes. Example:

%\mainlanguage[fr]
%\language[fr]
\starttext
currentlanguage:
\doifelse\currentlanguage{fr}{French}{Not French}\par
currentmainlanguage:
\doifelse\currentmainlanguage{fr}{French}{Not French}\par
translate: \translate[fr=Français, en=French]
\stoptext

-- 
   Peter
___
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
___

Re: [NTG-context] checking mainlanguage setup

2011-05-27 Thread Jeong Dalyoung
Dear Pontus, Marco, and Peter,

Thank you for replies.

I tested the following codes:

1)
\startluacode
if languages.current() == kr then
context(Korean)
else
context(Not Korean)
end
\stopluacode

2)
\doifelse\currentlanguage{en}{\def\lang{English}}{\def\lang{Not English}}\par
currentlanguage: \lang

are working well. 

But, the code

\startluacode
if languages.current() == kr then
context([[\def\lang{Korean}]]) %(\def\lang{Korean})
else
context([[\def\lang{English}]]) %(\def\lang{Korean})
end
\stopluacode

currentlanguage: \lang

is not working. (undifined control sequence error)

I think that there is a simple way to use lua code for this which I don't know. 
I have to read CLD manual.

Thanks again.

Best regards,

Dalyoung


On 2011. 5. 27., at 오후 10:09, ntg-context-requ...@ntg.nl wrote:

 Send ntg-context mailing list submissions to
   ntg-context@ntg.nl
 
 To subscribe or unsubscribe via the World Wide Web, visit
   http://www.ntg.nl/mailman/listinfo/ntg-context
 or, via email, send a message with subject or body 'help' to
   ntg-context-requ...@ntg.nl
 
 You can reach the person managing the list at
   ntg-context-ow...@ntg.nl
 
 When replying, please edit your Subject line so it is more specific
 than Re: Contents of ntg-context digest...
 
 
 Today's Topics:
 
   1. Re: checking mainlanguage setup (Pontus Lurcock)
   2. Re: checking mainlanguage setup (Marco)
   3. Re: checking mainlanguage setup (Peter =?utf-8?Q?M=C3=BCnster?=)
   4. [metafun] graphictext in mkiv (Marco)
   5. Re: compresslevel and png graphics (mkiv) (Peter Rolf)
   6. Re: \asciimode and cld (Hans Hagen)
   7. Re: compresslevel and png graphics (mkiv) (Hartmut Henkel)
   8. Re: compresslevel and png graphics (mkiv) (Hartmut Henkel)
 
 
 --
 
 Message: 1
 Date: Fri, 27 May 2011 22:11:24 +1200
 From: Pontus Lurcock p...@talvi.net
 To: ntg-context@ntg.nl
 Subject: Re: [NTG-context] checking mainlanguage setup
 Message-ID: 20110527101124.go20...@rae.vm.bytemark.co.uk
 Content-Type: text/plain; charset=us-ascii
 
 On Fri 27 May 2011, Jeong Dalyoung wrote:
 
 Is it possible to check what is the mainlanguage set in document?
 Now, I use \enablemode[kr] to do something A. But, I'd like to do it
 automatically if possible.
 
 According to http://wiki.contextgarden.net/Modes#System_modes , 
 the mode **kr should be automatically set if kr is the main language
 (I haven't tried it, though).
 
 Pont
 
 
 --
 
 Message: 2
 Date: Fri, 27 May 2011 12:22:38 +0200
 From: Marco net...@lavabit.com
 To: ntg-context@ntg.nl
 Subject: Re: [NTG-context] checking mainlanguage setup
 Message-ID: 20110527122238.4c709eb2@glyph
 Content-Type: text/plain; charset=US-ASCII
 
 I'd like to do the following type of setup.
 
 
 if mainlanguage == kr then
 
  do something A
 
 elseif mainlanguage == en then
 
  do something B
 
 else
  do something C
 
 endif
 
 \starttext
 \startluacode
  if languages.current() == kr then
context(Something A)
  elseif languages.current() == en then
 context(Something B)
  else
 context(Something C)
  end
 \stopluacode
 \stoptext
 
 Marco
 
 
 
 
 --
 
 Message: 3
 Date: Fri, 27 May 2011 12:41:46 +0200
 From: pmli...@free.fr (Peter =?utf-8?Q?M=C3=BCnster?=)
 To: mailing list for ConTeXt users ntg-context@ntg.nl
 Subject: Re: [NTG-context] checking mainlanguage setup
 Message-ID: 87ei3kifx1@micropit.couberia.bzh
 Content-Type: text/plain; charset=utf-8
 
 On Fri, May 27 2011, Jeong Dalyoung wrote:
 
 Is it possible to check what is the mainlanguage set in document?
 
 Yes. Example:
 
 %\mainlanguage[fr]
 %\language[fr]
 \starttext
 currentlanguage:
 \doifelse\currentlanguage{fr}{French}{Not French}\par
 currentmainlanguage:
 \doifelse\currentmainlanguage{fr}{French}{Not French}\par
 translate: \translate[fr=Fran?ais, en=French]
 \stoptext
 
 -- 
   Peter
 
 
 --
 
 Message: 4
 Date: Fri, 27 May 2011 12:45:58 +0200
 From: Marco net...@lavabit.com
 To: ntg-context@ntg.nl
 Subject: [NTG-context] [metafun] graphictext in mkiv
 Message-ID: 20110527124558.19b42ca1@glyph
 Content-Type: text/plain; charset=UTF-8
 
 The ?graphictext? makro does not work in mkiv, is it a bug
 or intended? This example works in mkii:
 
 \starttext
 \startMPcode
 draw image(graphictext FooBar scaled 8);
 \stopMPcode
 \stoptext
 
 Marco
 
 
 
 
 --
 
 Message: 5
 Date: Fri, 27 May 2011 13:57:51 +0200
 From: Peter Rolf indi...@gmx.net
 To: ntg-context@ntg.nl
 Subject: Re: [NTG-context] compresslevel and png graphics (mkiv)
 Message-ID: 4ddf91bf.8030...@gmx.net
 Content-Type: text/plain; charset=UTF-8
 
 Am 26.05.2011 18:17, schrieb Peter Rolf:
 Am 26.05.2011 12:52, schrieb Peter Rolf:
 Am 25.05.2011 21:54, schrieb Hartmut Henkel:
 [..]
 
 no. There is a PNG Copy function for literal embedding of the PNG
 file, but that triggers only

Re: [NTG-context] checking mainlanguage setup

2011-05-27 Thread Aditya Mahajan

On Sat, 28 May 2011, Jeong Dalyoung wrote:


\startluacode
if languages.current() == kr then
context([[\def\lang{Korean}]]) %(\def\lang{Korean})
else
context([[\def\lang{English}]]) %(\def\lang{Korean})
end
\stopluacode

currentlanguage: \lang

is not working. (undifined control sequence error)


(Untested) try

context.setvalue(lang, English)

or

context([[\\def\\lang{English}]])

Aditya
___
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
___