I am writing a package where I need to save the contents of several environments in verbatim mode to an auxiliary file. Then the auxiliary file is processed by an external program. In the next compilation of the document, the output of the external program is input in the document.

I am using fancyvrb to output the contents of the environment to the auxiliary file.

I already have something working, except that inputenc gives an error when non ascii unicode characters (i.e. accented letters like á) are used in the environment.

In order to demonstrate the problem, I have written the following simplified package which defines the testenv environment.


\ProvidesPackage{testenv}[2012/03/10 v0.1 JRM test environment]


% =========================================================
% fancyvrb new commands to append to a file
% =========================================================





% =========================================================
% my test environment
% =========================================================



% =========================================================
% final actions
% =========================================================

    \PackageWarning{testenv}{File `\jobname.testenv' not found.}%



And I am using the following document to test it:




  This is a test with this unicode char: á.


When compiled with pdflatex, I am getting the following error message:

! Package inputenc Error: Unicode char \u8:á.\fi not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.

l.11     \end{testenv}

Does anybody has any clue on how to solve this problem?


You can try changing




adding the definition


The problem is that characters beyond "7F are made active and they are expanded by \write.

By the way, the line


can be reduced to


since \def is not expandable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.