On 3/12/2014 10:21 AM, Wolfgang Schuster wrote:
>
> Am 12.03.2014 um 15:12 schrieb Lars Huttar <lars_hut...@sil.org
> <mailto:lars_hut...@sil.org>>:
>
>> On 3/12/2014 10:05 AM, Wolfgang Schuster wrote:
>>> Am 12.03.2014 um 15:00 schrieb Lars Huttar <lars_hut...@sil.org
>>> <mailto:lars_hut...@sil.org>>:
>>>
>>>> Hello,
>>>> I've got a running page head like this in my document:
>>>>
>>>> \def\CurrentUser{\cldcontext{os.resultof"whoami"}}
>>>>
>>>> \def\Markname { Compiled \date by \CurrentUser  \LUATEX +\ConTeXt\
>>>> \contextversion }
>>>>
>>>> and later:
>>>>
>>>> \setlayer[cropmark][preset=lefttop,x=3cm,y=-1.5\lineheight]{\Markname}
>>>>
>>>> But when I run this, I get a UCS error that seems to indicate that the
>>>> *result* of \CurrentUser ("waxhaw\huttar") is getting parsed as a
>>>> command sequence.
>>> When you want to pass a backslash to Lua you have to use
>>> \letterbackslash.
>>>
>>
>> Thanks... can you give me an example of what that would look like?
>> I don't think I want to pass a backslash to Lua, so I'm not sure how to
>> apply what you're saying. Or are you using "Lua" here in the sense of
>> LuaTeX?
>>
>> A backslash appears in the output of os.resultof"whoami"; do I need to
>> perform some processing on that output in order to escape backslashes?
>
> Try this:
>
> \def\CurrentUser{\cldcontext{os.resultof"whoami"}}
>
> \def\Markname{Compiled \date by \detokenize\expandafter{\CurrentUser}
> \LUATEX +\ConTeXt\ \contextversion.}
>
> \setuplayout[location=middle,marking=on]
>
> \definelayer[cropmark][state=repeat,width=\paperwidth,height=\paperheight]
>
> \setupbackgrounds[page][background=cropmark]
>
> \setlayer[cropmark][preset=lefttop,x=3cm,y=1.5\lineheight]{\Markname}
>
> \starttext
>
> Foo
>
> \stoptext
>
>

Thanks again...
This gets rid of the error, but it seems to prevent any expansion of the
content of \CurrentUser, because the page head now literally looks like
this:

 Compiled March 12, 2014 by \cldcontext {os.resultof"whoami"}. 
LuaTEX+ConTEXt...

Lars

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

Reply via email to