0

In following MWE, letters with an accent that are within the personalized comment environment are generating following errors while compiling with pdflatex:

! Package inputenc Error: Unicode char �tr (U+F0) (inputenc) not set up for use with LaTeX.

Question: How to enable unicode characters within a comment-environment?


\documentclass{scrartcl}

    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{comment}
            \includecomment{mycomment}   

\begin{document}

    \section*{Normal text}
            Tous les êtres humains naissent libres et égaux en dignité et en droits.

    \section*{Text within a displayed personnalized comment}
\begin{mycomment}
        Tous les êtres humains naissent libres et égaux en dignité et en droits.
\end{mycomment}
\end{document}

MWE output

ebosi
  • 11,692
  • it is! Thank you for noticing. I'm going to post an answer to mark it as resolved, but please let me know if the etiquette prefers to delete the duplicate question. – ebosi Nov 30 '15 at 15:34
  • You can vote to close it or delete it. It's up to you. – egreg Nov 30 '15 at 15:35

1 Answers1

0

(As noticed by egreg, this question is a duplicate of comment.sty and UTF8 encoding)

The solution is to partially redefine the internal functioning of the comment.

The three lines added before \begin{document} in following MWE do the job!


\documentclass{scrartcl}

        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{comment}
                \includecomment{mycomment} 

        \renewcommand\ThisComment[1]{%
                \immediate\write\CommentStream{\unexpanded{#1}}%
        }  

\begin{document}

        \section*{Normal text}
                Tous les êtres humains naissent libres et égaux en dignité et en droits.

        \section*{Text within a displayed personnalized comment}
\begin{mycomment}
            Tous les êtres humains naissent libres et égaux en dignité et en droits.
\end{mycomment}
\end{document}
ebosi
  • 11,692