Am 12.03.2014 um 15:12 schrieb Lars Huttar <lars_huttar@sil.org>:

On 3/12/2014 10:05 AM, Wolfgang Schuster wrote:
Am 12.03.2014 um 15:00 schrieb Lars Huttar <lars_huttar@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

Wolfgang