<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi, Mauricio.<br>Since LaTeX reserves inverted slashes for internal use, I cannot tamper with it.&nbsp; The idea is to transfer the problem to Haskell (or Clean, or Scheme), not to LaTeX. After all, it is easier to program in Haskell, Clean or Scheme than in LaTeX. Anyway, here is what happens if I follow your suggestion:<br><br>-- File tudin.hs<br>import Htudin<br>import IO<br>import That<br>main= do <br>&nbsp;outh &lt;- openFile "tudin-G-H-C1.ghc" WriteMode; <br>&nbsp;hPutStrLn outh (acc "Hello, fa\unhbox \voidb@x \setbox \z@ \hbox {c}{\lineskiplimit -\maxdimen \unhbox \voidb@x \vtop {\baselineskip \z@skip \lineskip .25ex\everycr {}\tabskip \z@skip \halign {##\crcr \unhbox \z@ \crcr \hskip \hideskip \char 24\hskip \hideskip \crcr }}}ade!")<br><br>&nbsp;hClose outh;<br>&nbsp;outh &lt;- openFile "tudin-G-H-C2.ghc" WriteMode; <br>&nbsp;hPutStrLn outh (show (fat
 6))<br><br>&nbsp;hClose outh;<br><br><br>As you can see, LaTeX sends its macro expansion to the Haskell file.&nbsp; Another possibility is to change the classification of \ (reverse slash). Here is how to do it:<br><br>\catcode`\\=11<br><br>Now the reverse slash is a normal char. Of course, I need to change the classification of every accent, tilde, cedil, umlaut, etc. I cannot change the grave, because I need it to make the change itself. Users don't like this kind of solution. In any case, here are the programs with the characters modified (I will post a more complete library in my site; then I will add a few graphical functions so people can understand the problem). Compilation is as before:<br><br>1 --- C:\hastex&gt;&nbsp; latex tudin.tex<br>2 --- C:\hastex&gt; runghc tudin.hs<br>3 --- C:\hastex&gt; latex tudin.tex<br><br>It is possible to use pdflatex instead of latex. By the way, Haskell cannot print your name, since it has an acute i :-) It would
 be great if people could solve this problem.<br><br>% Store in file hask.ell<br>% Last change 2007-05-23 <br><br>\newcount\evalFilecount<br>\evalFilecount=0<br><br>{\gdef\evalSetup{%<br>&nbsp; \csname newwrite\endcsname\outPort % Port name<br>&nbsp; \immediate\openout\outPort \jobname.hs %<br>&nbsp; \newlinechar=`\^^M% <br>&nbsp; \immediate\write\outPort{import H\jobname}%<br>&nbsp;&nbsp; \newlinechar=`\^^M% <br>&nbsp; \immediate\write\outPort{import IO}%<br>&nbsp;&nbsp; \newlinechar=`\^^M% <br>&nbsp; \immediate\write\outPort{main= do&nbsp; }%<br>&nbsp; \newlinechar=`\^^M% <br>}%<br>}<br><br>\newcommand{\eval}{\begingroup<br>&nbsp; \ifx\outPort\UNDEFINED \evalSetup\fi<br>&nbsp; \global\advance\evalFilecount by 1<br>&nbsp; \edef\evalAuxFile{\jobname-G-H-C\the\evalFilecount}%<br>&nbsp; \immediate\write\outPort<br>&nbsp;&nbsp;&nbsp; {&nbsp; outh &lt;- openFile "\evalAuxFile.ghc" { WriteMode;} }%<br>&nbsp;
 {\immediate\openin0=\evalAuxFile.ghc<br>&nbsp;&nbsp; \ifeof0 \immediate\closein0 <br>&nbsp;&nbsp; \else \input \evalAuxFile.ghc \fi}%<br>&nbsp; \catcode`\^^M=12 <br>&nbsp; \catcode`\\=11<br>&nbsp; \catcode`\~=11<br>&nbsp; \catcode`\'=11<br>&nbsp; \catcode`\`=11<br>&nbsp; \catcode`\^=11<br>&nbsp; \evalBody <br>&nbsp;}<br><br>\newcommand{\evalBody}[1]{%<br>&nbsp; \immediate\write\outPort{#1}%<br>&nbsp; \immediate\write\outPort{&nbsp;&nbsp; hClose outh;}%<br>&nbsp; \endgroup<br>&nbsp; }<br>%end of file hask.ell<br><br><br><br><br>% Store in file&nbsp; haskell.gen<br>% Last change 2007-05-23 <br><br>\newcount\evalFilecount<br>\evalFilecount=0<br><br>{\gdef\haskellSetup{%<br>&nbsp; \csname newwrite\endcsname\progPort <br>&nbsp; \immediate\openout\progPort H\jobname.hs %<br>&nbsp; \immediate\write\progPort{module H\jobname}%<br>&nbsp; \immediate\write\progPort{where}%<br>&nbsp; \newlinechar=`\^^M% <br>&nbsp;
 \newlinechar=`\^^M%<br>}%<br>}<br><br>\newcommand{\haskell}{\begingroup<br>&nbsp; \ifx\progPort\UNDEFINED \haskellSetup\fi%<br>&nbsp; \catcode`\^^M=12 <br>&nbsp; \haskellGen<br>&nbsp;}<br><br>\newcommand{\haskellGen}[1]{%<br>&nbsp; \immediate\write\progPort{#1}%<br>&nbsp; \endgroup<br>&nbsp; }<br>%end of file haskell.gen<br><br><br><br>% File: tudin.tex<br>\documentclass[12pt]{article}<br>\usepackage[latin1]{inputenc}<br>\usepackage[brazil]{babel}<br>\usepackage{makeidx}<br>\usepackage{wrapfig}<br>\usepackage{pictexwd}<br><br>\newcommand{\cc}{\c{c}}<br><br>\title{Calling Haskell from \LaTeX}<br>\author{Philippos Apolinarius}<br>\date{}<br><br>\begin{document}<br>\maketitle<br><br>\input haskell.gen<br>\input hask.ell % load \eval <br><br><br>\eval{ hPutStrLn outh "Hello, fa\\c cade!"<br>}<br><br>\eval{ hPutStrLn outh "Il est l\\`a bas!"<br>}<br><br>\eval{ hPutStrLn outh "Raison d' \\^etre!"<br>}<br><br>\eval{ hPutStrLn outh "Votre toast, je peux vous le
 rendre, Se\\~nor!"<br>}<br><br>\eval{ hPutStrLn outh (show (fat 6))<br>}<br><br>\haskell{<br>&nbsp;fat n | n&lt;1= 1<br>&nbsp;fat n= n*fat(n-1)<br>}<br>\end{document}<br><br><br><br><br><br><br><br><br>&nbsp;<br><br>--- On <b>Sat, 10/24/09, Maurí­cio CA <i>&lt;mauricio.antunes@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Maurí­cio CA &lt;mauricio.antunes@gmail.com&gt;<br>Subject: [Haskell-cafe] Re: A 3 line program --&gt; Reid, Don, Daniel<br>To: haskell-cafe@haskell.org<br>Received: Saturday, October 24, 2009, 8:28 PM<br><br><div class="plainMail">Philippos,<br><br>Doesn't the line below means everything to be interpreted will be<br>considered as latin1?<br><br>&nbsp; \usepackage[latin1]{inputenc}<br><br>Unicode as UTF-8 won't fit here.<br><br>I would sugest transfering the problem to latex. Why not to print<br>'fa\c cade' instead of 'façade'? It's 7
 bits and will never fail.<br><br>Best,<br>Maurício<br><br>&gt; Thank you for your help. I am sure that you are right as to the cause of the problem.&nbsp; However, I do not know what I should do to solve it. The Haskell program is generated by LaTeX macros. (...)<br><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></blockquote></td></tr></table><br>
      <hr size=1>Ask a question on any topic and get answers from real people. <a href="http://ca.answers.yahoo.com"><b>Go to Yahoo! Answers.</b></a>