
我正在嘗試定義一個自訂環境,其中所有文字都帶有下劃線。我知道該underline
命令強調了它的輸入,但我不知道如何讓它與我的環境無縫工作:
\documentclass{article}
\newenvironment{myenvironment}{\underline}{}
\begin{document}
Not underlined
\begin{myenvironment}
Only first character is underlined
\end{myenvironment}
\underline{Underlined correctly}
\end{document}
如何將underline
(或其他命令)應用於環境中的所有文字?
如果重要的話,請使用 xelatex 2015。
答案1
您正在尋找soulutf8
和environ
。但是,請再考慮一下底線。
\documentclass{article}
\usepackage{fontspec}
\usepackage{soulutf8,environ}
\NewEnviron{myenvironment}{\expandafter\ul\expandafter{\BODY}}
\begin{document}
Not underlined
\begin{myenvironment}
All words are underlined
All words are underlined
All words are underlined
All words are underlined
All words are underlined
\end{myenvironment}
\ul{Underlined correctly}
\end{document}