
いくつかの単語の後にテキストを揃えたいのですが、この答え@Torbjørn T による投稿。ただし、エラー メッセージが表示されました。コードは次のとおりです。
\documentclass{report}
\usepackage{xcolor}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\linewidth}{@{}lX@{}}
\textcolor{blue}{\textit{Name of the Experiment:} & Frequency Stability Study of a Power System blah blah blah}
\end{tabularx}
\end{document}
エラーメッセージは次のとおりです。
line 9: Missing } inserted. \end{tabularx}
line 9: Extra }, or forgotten \endgroup. \end{tabularx}
line 9: Missing } inserted. \end{tabularx}
line 9: Extra }, or forgotten \endgroup. \end{tabularx}
line 9: Missing } inserted. \end{tabularx}
line 9: Extra }, or forgotten \endgroup. \end{tabularx}
line 9: Overfull \hbox (15.0pt too wide) in paragraph
これをどう解決すればいいでしょうか?
私は MiKTeX と PDFLaTeX を使用しています。
答え1
基本的に、問題は、 でテキスト カラーを開いて\textcolor{blue}{
から次のセル ( ) を開始できないことです。まず閉じてから次のセルを開始する&
必要があります。\textcolor{blue}{}
最初の列に何をしたいのか実験名:青色の場合は、次のようにして、早めにテキストカラーを閉じる必要があります。
\documentclass{report}
\usepackage{xcolor}
\usepackage{tabularx}
\begin{document}
\begingroup
\begin{tabularx}{\linewidth}{@{}lX@{}}
\textcolor{blue}{\textit{Name of the Experiment:}} & Frequency Stability Study of a Power System blah blah blah
\end{tabularx}
\end{document}
または、表内のすべてのテキストを青色にしたい場合、次のように表を別のグループにラップします。
\documentclass{report}
\usepackage{xcolor}
\usepackage{tabularx}
\begin{document}
\begingroup %%start wrapper group
\color{blue} %%assign textcolor
\begin{tabularx}{\linewidth}{@{}lX@{}}
\textit{Name of the Experiment:} & Frequency Stability Study of a Power System blah blah blah
\end{tabularx}
\endgroup%%end wrapper group
\end{document}
見てみましょうxcolor ドキュメント- 行の背景色を変更することもできます。