このようなカラーテキストを LaTeX で記述するにはどうすればよいでしょうか?

このようなカラーテキストを LaTeX で記述するにはどうすればよいでしょうか?

LaTeX ドキュメントに次のテキストを追加する必要があります。現在、いくつかの画像を作成してドキュメントに追加しています。

最新のプロジェクトにテキストとして追加する簡単な方法を知る必要があります。

さらに必要なのは、ページの中央に配置し、デフォルトのフォントよりも大きいフォント サイズを使用することです。(私のドキュメントのデフォルトのテキストは 12 ポイントです。) 境界線を追加する必要はありません。

ここに画像の説明を入力してください

答え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がすでにこれまでに提供された回答の1つを受け入れていることに気付きました。少し変化をつけるために、\boldredcaps引数のすべての大文字を太字と赤で表示するというLaTeXマクロを提供するソリューションを示します。自動的に\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}

ここに画像の説明を入力してください

関連情報