Re: How can I write "%" to a file?
- From: Timothy Murphy <tim@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 28 Jan 2006 14:32:22 +0000
Morten Høgholm wrote:
>> I want a LaTeX program to write the line "%&latex" to a Metapost file,
>> but when I say
>> \immediate\write\mpfile{%&latex}
>> I get an error, since % causes the rest of the line to be ignored.
>> On the other hand, if I say
>> \immediate\write\mpfile{\%&latex}
>> then "\%" is written to the file.
>>
>> How can I write an unadorned "%"?
>
> LaTeX has an internal \@percentchar which expands to a harmless %.
Thanks very much.
That works perfectly:
----------------------------------
\documentclass{article}
\newwrite\myfile
\begin{document}
\immediate\openout\myfile\jobname.out
\makeatletter
\immediate\write\myfile{\@percentchar}
\makeatother
\immediate\closeout\myfile
\end{document}
----------------------------------
It's not really clear to me why I can't just say \%,
but I guess that is one of the mysteries of life.
--
Timothy Murphy
e-mail (<80k only): tim /at/ birdsnest.maths.tcd.ie
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
.
- Follow-Ups:
- Re: How can I write "%" to a file?
- From: Heiko Oberdiek
- Re: How can I write "%" to a file?
- References:
- How can I write "%" to a file?
- From: Timothy Murphy
- Re: How can I write "%" to a file?
- From: Morten Høgholm
- How can I write "%" to a file?
- Prev by Date: Re: tabular in itemize - height justification problems
- Next by Date: Re: tex4ht and back ticks / single quotes
- Previous by thread: Re: How can I write "%" to a file?
- Next by thread: Re: How can I write "%" to a file?
- Index(es):
Relevant Pages
|
Loading