答案1
像这样?
\documentclass{article}
\usepackage{xcolor}
\begin{document}
\begin{center}
\Large\sl
\textcolor{red}{S}ince \textcolor{red}{E}veryone \textcolor{red}{C}an \textcolor{red}{R}ead, \textcolor{red}{E}ncoding \textcolor{red}{T}ext \textcolor{red}{I}n \textcolor{red}{N}eutral \textcolor{red}{S}entences \textcolor{red}{I}s \textcolor{red}{D}oubtfully \textcolor{red}{E}ffective
\vspace{1cm}\LARGE\color{red}
`Secret inside'
\end{center}
\end{document}
答案2
我注意到 OP 已经接受了目前提供的一个答案。为了提供一些变化,这里有一个解决方案,它提供了一个名为的 LaTeX 宏,\boldredcaps
它将其参数中的所有大写字母以粗体和红色呈现自动地。无需手动输入大量\textbf{\textcolor{red}{...}}
指令。LaTeX 宏\boldredcaps
依靠 Lua 强大的gsub
字符串函数来完成其工作。
% !TEX TS-program = lualatex
\documentclass[12pt]{article}
\usepackage{xcolor} % for "\textcolor" macro
\usepackage{ragged2e} % for "\Centering" macro
\usepackage{luacode} % for "\luaexec" macro
%% Define a LaTeX macro called "\boldredcaps":
\newcommand\boldredcaps[1]{\luaexec{%
yyy = "#1"
yyy = yyy:gsub ( "\%u" , "\\textbf{\\textcolor{red}{\%0}}" )
tex.sprint ( yyy )
}}
%% Concoct steganographic message:
\newcommand{\blurb}{Since Everyone Can Read, Encoding Text In Neutral Sentences Is Doubtfully Effective.}
\begin{document}
\begin{figure}
\Large % or "\large", or "\huge", etc
\sffamily\itshape
\Centering
\boldredcaps{\blurb} % <-- argument of \boldredcaps can be a macro
\bigskip
\textbf{\textcolor{red}{`secret inside'}}
\rmfamily\upshape
\caption{Text Steganography}
\end{figure}
\end{document}
答案3
如果您需要经常执行此操作,可以使用以下方法自动xstring
替换\StrSubstitute
空格\textcolor{red}
:
代码:
\documentclass{article}
\usepackage{xcolor}
\usepackage{xstring}
\newcommand*{\Hightlight}[1]{%
\noexpandarg
\StrSubstitute[0]{\textcolor{red}#1}{ }{ \textcolor{red}}[\FormattedString]%
\FormattedString%
}%
\begin{document}
\Hightlight{Since Everyone Can Read, Encoding Text In Neutral Sentences Is Doubtfully Effective}
\end{document}
答案4
提供的代码应该会给出所附的图片。它符合你的要求吗?你可以根据需要调整代码。
\documentclass{article}
\usepackage{xcolor}
\usepackage{framed}
\begin{document}
\begin{framed}
\centering
\textbf{\color{red} S}ince \textbf{\color{red} E}veryone \textbf{\color{red} C}an \textbf{\color{red} R}ead, \textbf{\color{red} E}ncoding \textbf{\color{red} T}ext \textbf{\color{red} I}n \textbf{\color{red} N}eutral \textbf{\color{red} S}entences \textbf{\color{red} I}s \textbf{\color{red} D}oubtfully \textbf{\color{red} E}ffective. \\ \vspace{5mm}
{\large \textbf{\color{red} 'Secret inside'}}
\end{framed}
\end{document}