TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
That fixed the problem. Thanks. – Romildo Mar 9 '12 at 22:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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