换行环境中的变音符号会破坏文档

换行环境中的变音符号会破坏文档

感谢我之前发帖的用户 Eric DomenjoudLaTeX 文档的全局换行符我可以在自动生成的报告中拆分文本。请参阅下面 Eric 的示例:

\documentclass{article}

\makeatletter
\newenvironment{wraplines}[1][]{%
  % encapsulate hyphenation character in a \hbox so that
  % it may be arbitrary restricted horizontal mode material e.g $\rightarrow$
  \def\@wrapdiscr{\discretionary{\hbox{#1}}{}{}}%
  \@wraplines
}{}
\newcommand\@wraplines{%
  \@ifnextchar\end\relax{%
    \@ifnextchar\par{%
      \par\expandafter\@wraplines\@gobble
    }%
    \@wraplines@aux
  }%
}
\def\@wraplines@aux#1 {\x@wraplines@aux#1\@nnil}
\newcommand*\x@wraplines@aux[1]{#1\y@wraplines@aux}
\newcommand*\y@wraplines@aux[1]{%
  \ifx#1\@nnil
    \space
    \expandafter\@wraplines
  \else
    \@wrapdiscr#1%
    \expandafter\y@wraplines@aux
  \fi
}
\makeatother

\begin{document}
\begin{wraplines}
\end{wraplines}

\noindent\verb|\begin{wraplines} ... \end{wraplines}|

\begin{wraplines}
Xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\end{wraplines}

\bigskip

\noindent\verb|\begin{wraplines}[-] ... \end{wraplines}|

\begin{wraplines}[-]
Xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\end{wraplines}

\bigskip

\noindent\verb|\begin{wraplines}[$\rightarrow$] ... \end{wraplines}|

\begin{wraplines}[$\rightarrow$]
Xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
\end{wraplines}

\end{document}

这个解决方案非常好,几乎解决了我的问题(非常感谢 Eric)!但是有一个小问题:变音符号...

使用以下 LaTeX:

\begin{wraplines}
äüö
\end{wraplines}

我收到此错误信息:

! Package inputenc Error: Unicode char �\y@wraplines@aux (U+67B)
(inputenc)                not set up for use with LaTeX.

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

l.36   äüö

在我的文档中,通常使用变音符号没有问题(我使用了必要的标题)。只有在环境中,wraplines转换为 PDF 时才会中断。

有人有办法解决这个问题吗?

相关内容