你好,社区有人能帮我吗?为什么表格显示这样?有什么想法吗?
代码如下:
\renewcommand\theadfont{\normalsize\bfseries}
\definecolor{myblue1}{rgb}{0.776,0.851,0.945}
\definecolor{myblue2}{rgb}{0.722,0.8,0.894}
\definecolor{myblue3}{rgb}{0.584,0.702,0.843}
\definecolor{myblue4}{rgb}{0.329,0.553,0.831}
\definecolor{myblue5}{rgb}{0.212,0.373,0.569}
\definecolor{myblue6}{rgb}{0.141,0.251,0.38}
\definecolor{myblue7}{rgb}{0.086,0.149,0.227}
\begin{document}
\begin{table*}[b]
\arrayrulecolor[rgb]{0.212,0.373,0.569}
\begin{tabularx}{\textwidth}{|>{\raggedright\arraybackslash}X|*{12}{wc{1em}|}}
\hline
& \multicolumn{12}{c|}{\thead{Duration of Project}} \\
\cline{2-13}
\thead{Works} & \multicolumn{6}{c|}{\thead{1$^{st}$ Year (Months)}} & \multicolumn{6}{c|}{\thead{2$^{nd}$ Year (Months)}} \\
\cline{2-13}
& \thead{2} & \thead{4} & \thead{6} & \thead{8} & \thead{10} & \thead{12}
& \thead{2} & \thead{4} & \thead{6} & \thead{8} & \thead{10} & \thead{12} \\
\hline
Literature survey, purchase of chemicals
& & \cellcolor{myblue1} & \cellcolor{myblue1} & & & & & & & & & \\
\hline
Synthesis and calcination of \ch {Ba_{1-x}La_{x}Fe_{1-y}Nb_{y}O_{3-\chemdelta}}{(x: 0.1 and y: 0.05 & 0.1)} perovskite powders.
& & & & \cellcolor{myblue2} & \cellcolor{myblue2} & & & & & & & \\
\hline
Characterizations of \ch{Ba_{1-x}La_{x}Fe_{1-y}Nb_{y}O_{3-\chemdelta}}{(x: 0.1 and y: 0.05 & 0.1)} perovskite powders.
& & & & & & \cellcolor{myblue3} & \cellcolor{myblue3} & & & & & \\
\hline
Fabrication and densification of bulk \ch{Ba_{1-x}La_{x}Fe_{1-y}Nb_{y}O_{3-\chemdelta}}{(x: 0.1 and y: 0.05 & 0.1)} samples
& & & & & & & & \cellcolor{myblue4} & \cellcolor{myblue4} & & & \\
\hline
Density and microstructural studies of \ch{BaFe_{0.9-x}Nb_{x}O_{3-\chemdelta}} (x: 0, 0.05 and 0.1) bulk samples
& & & & & & & & & \cellcolor{myblue5} & \cellcolor{myblue5} & & \\
\hline
Stress-strain curves and ferro elastic hysteresis loops studies using cyclic uniaxial compression tests.
& & & & & & & & & & & \cellcolor{myblue6} & \cellcolor{myblue6} \\
\hline
Publications of the analyzed results
&
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
& \cellcolor{myblue7}
\\
\hline
\end{tabularx}
\arrayrulecolor{black}
\label{Table}
\caption{Gantt Chart of thesis}
\end{table*}
答案1
只需看一眼,我就能保证您在运行中忽略了错误。我猜问题在于您输入的所有位置都是0.05 & 0.1
您想要的0.05 \& 0.1
。
不要忽视 LaTeX 错误。他们正在告诉你重要的事情。
答案2
错误由 Don Hosek 给出。有关信息,请参阅以下如何使用 轻松完成该{NiceTabular}
表nicematrix
。
\documentclass{article}
\usepackage[nohead, nomarginpar, margin=0.6in, foot=.25in]{geometry}
\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{mathtools}
\usepackage{amssymb}
\usepackage{upgreek}
\usepackage{chemmacros}
\usepackage{makecell}
\usepackage{nicematrix}
\begin{document}
\renewcommand\theadfont{\normalsize\bfseries}
\begin{table*}[b]
\newlength{\mylength}
\setlength{\mylength}{\linewidth-12em-26\tabcolsep-14\arrayrulewidth}
\begin{NiceTabular}{>{\raggedright\arraybackslash}p{\mylength}*{12}{wc{1em}}}%
[hvlines,rules/color=[rgb]{0.212,0.373,0.569}]
\CodeBefore
\rectanglecolor[rgb]{0.776,0.851,0.945}{4-3}{4-4}
\rectanglecolor[rgb]{0.722,0.8,0.894}{5-5}{5-6}
\rectanglecolor[rgb]{0.584,0.702,0.843}{6-7}{6-8}
\rectanglecolor[rgb]{0.329,0.553,0.831}{7-9}{7-10}
\rectanglecolor[rgb]{0.212,0.373,0.569}{8-10}{8-11}
\rectanglecolor[rgb]{0.141,0.251,0.38}{9-12}{9-13}
\rectanglecolor[rgb]{0.086,0.149,0.227}{10-3}{10-13}
\Body
\Block{3-1}{} & \Block{1-12}{\thead{Duration of Project}} \\
\thead{Works} & \Block{1-6}{\thead{1st Year (Months)}} &&&&&& \Block{1-6}{\thead{2nd Year (Months)}} \\
& \thead{2} & \thead{4} & \thead{6} & \thead{8} & \thead{10} & \thead{12}
& \thead{2} & \thead{4} & \thead{6} & \thead{8} & \thead{10} & \thead{12} \\
Literature survey, purchase of chemicals \\
Synthesis and calcination of \ch {Ba_{1-x}La_{x}Fe_{1-y}Nb_{y}O_{3-\chemdelta}}{(x: 0.1 and y: 0.05 \& 0.1)} perovskite powders. \\
Characterizations of \ch{Ba_{1-x}La_{x}Fe_{1-y}Nb_{y}O_{3-\chemdelta}}{(x: 0.1 and y: 0.05 \& 0.1)} perovskite powders. \\
Fabrication and densification of bulk \ch{Ba_{1-x}La_{x}Fe_{1-y}Nb_{y}O_{3-\chemdelta}}{(x: 0.1 and y: 0.05 \& 0.1)} samples \\
Density and microstructural studies of \ch{BaFe_{0.9-x}Nb_{x}O_{3-\chemdelta}} (x: 0, 0.05 and 0.1) bulk samples \\
Stress-strain curves and ferro elastic hysteresis loops studies using cyclic uniaxial compression tests. \\
Publications of the analyzed results \\
\end{NiceTabular}
\end{table*}
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。