단어 뒤의 텍스트를 정렬하는 중 오류가 발생했습니다.

단어 뒤의 텍스트를 정렬하는 중 오류가 발생했습니다.

일부 단어 뒤에 텍스트를 정렬하고 싶습니다. 나는 팔로우했다이 답변by @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}{}먼저 닫은 후 다음 셀을 시작해야 합니다 .

첫 번째 열을 원했거나실험 이름:파란색으로 설정한 경우 다음과 같이 해야 하며 textcolor를 더 일찍 닫아야 합니다.

\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 문서- 행의 배경색을 변경할 수도 있습니다.

관련 정보