TeX - LaTeX Asked on December 25, 2020
I want to align text after some words. I followed this answer by @Torbjørn T. But there were error messages. Here is the code:
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}
The error messages are as below:
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
How can this be solved?
I am using MiKTeX and PDFLaTeX.
Basically your problem is that you cannot open text color with textcolor{blue}{
and then start the next cell (with &
). You have to close textcolor{blue}{}
first then start the next cell.
Either you wanted do to the first column Name of the Experiment: in blue then you have to do it like this, and close the textcolor earlier:
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}
or you wanted to have all the text in the table blue. Then you wrap the table in a seperate group like this:
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}
Have a look at the xcolor documentation - you can also change the background color of the rows.
Correct answer by nhck on December 25, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP