我尝试使用\textbf
、\textit
和\underline
命令来强调文本。但文本不会自动换行到下一行。我也尝试了该ulem
包,但它也没有用。有人知道如何为某些文本添加斜体、粗体、下划线和换行符吗?
答案1
以下不言自明的组合适合您吗?(撇开美学问题。)
\documentclass{article}
\usepackage{ulem}
\begin{document}
I think computer \uline{viruses should count as life. I think it says
something about human nature} that the only form of life we have
created so far is purely destructive. We've created life in our own
image.
I think computer \uline{viruses should \textit{count as life. I think
it} says something about human nature} that the only form of life
we have created so far is purely destructive. We've created life in
our own image.
I think computer \uline{\textit{viruses should count as life. I think
it} says something about human nature} that the only form of life
we have created so far is purely destructive. We've created life in
our own image.
I think computer \uline{\textit{viruses should count \textbf{as
life. I think} it} says something \textbf{about human} nature}
that the only form of life we have created so far is purely
destructive. We've created life in our own image.
\textit{\textbf{\uline{I think computer viruses should count as
life. I think it says something about human nature that the only
form of life we have created so far is purely destructive. We've
created life in our own image.}}}
\end{document}
\documentclass{article}
\usepackage{ulem}
尖端
\uline
当你需要对整个段落应用多种效果时,请始终应用最后一个。如果在其后应用其他字体命令,则其行为会很糟糕(不换行)。
答案2
如果您已经在使用它,那么最好坚持使用ulem
它。但是,如果我必须混合搭配下划线、粗体和斜体,我会倾向于使用它soul
。它不需要太多关注如何嵌套所有这些强调方式。
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{soul}
\parskip10pt
\parindent0pt
\begin{document}
% all at once:
\ul{\textbf{\textit{I was trying to emphasize text with textbf, textit
and underline commands. But the text will not automatically wrap
to the next line. I also tried the {ulem} package, and it did
not work too. Does anybody know how to have italic, bold,
underline and linebreaks for some text?}}}
% underline, then \emph, then bold
I think computer \ul{viruses \emph{should count \textbf{as life. I
think it says something about human nature that the only form of
life we have created so far is purely destructive. We've created
life in} our} own} image.
% underline, bold, emph
I think computer \ul{viruses \textbf{should count \emph{as life. I
think it says something about human nature that the only form of
life we have created so far is purely destructive. We've created
life in} our} own} image.
% bold, emph, underline
I think computer \textbf{viruses \emph{should count \ul{as life. I
think it says something about human nature that the only form of
life we have created so far is purely destructive. We've created
life in} our} own} image.
% emph, bold, underline
I think computer \emph{viruses \textbf{should count \ul{as life. I
think it says something about human nature that the only form of
life we have created so far is purely destructive. We've created
life in} our} own} image.
% bold, underline, emph
I think computer \textbf{viruses \ul{should count \emph{as life. I
think it says something about human nature that the only form of
life we have created so far is purely destructive. We've created
life in} our} own} image.
% emph, underline, bold
I think computer \emph{viruses \ul{should count \textbf{as life. I
think it says something about human nature that the only form of
life we have created so far is purely destructive. We've created
life in} our} own} image.
\end{document}