O que há de errado com este tabularx?
Eu odeio tabelas em LaTeX! Estou sempre me metendo em alguns problemas, mas isso deve ser fácil:
\documentclass[12pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{tabularx}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|X|X|X|X|X|}
\hline
\rowcolor[gray]{0.95}
\multicolumn{5}{|c|}{Title}
\\ \hline
\multicolumn{1}{|c|}{\textsf{Day 1}}
& \multicolumn{1}{c|}{\textsf{Day 2}}
& \multicolumn{1}{c|}{\textsf{Day 3}}
& \multicolumn{1}{c|}{\textsf{Day 4}}
& \multicolumn{1}{c|}{\textsf{Day 5}}
\\ \hhline{|=|=|=|=|=|}
\multicolumn{1}{|c|}{Text 1}
& \multicolumn{1}{c|}{Text 2}
& \multicolumn{1}{c|}{Text 3}
& \multicolumn{1}{c|}{Text 4}
& \multicolumn{1}{c|}{Text 5}
\\
\multicolumn{1}{|c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
\\ \hline
\end{tabularx}
\end{center}
\end{document}
Visualização do problema:
Como mostra a foto, a mesa não fecha do lado direito. O que há de errado com o código?
Respostas
Você perguntou,
O que há de errado com o código?
O código encerra (encobre?) Cada célula em um \multicolumn{1}{|c|}{...}wrapper, substituindo completamente a Xcapacidade do tipo de coluna de fornecer quebra automática de linha dentro das células. Em consequência, não há absolutamente nenhuma razão para esperar que a largura do tabularxambiente seja igual a \textwidth.
O remédio? Você precisa (a) livrar-se dos \multicolumn{1}{|c|}{...}invólucros, para que o tabularxmaquinário possa realmente fazer seu trabalho e (b) definir e empregar uma versão do Xtipo de coluna que centraliza em vez de justificar totalmente o conteúdo da célula. Consulte o código abaixo para obter maneiras de satisfazer a segunda condição.
Para o exemplo em questão, reduzir o valor de \tabcolsep-- o parâmetro que controla a quantidade de espaço em branco entre colunas -- pela metade consegue evitar quebras de linha na linha final. Veja o segundo tabularxexemplo na captura de tela a seguir para obter a "aparência" resultante.
\documentclass[12pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage[total={6in,10in}, left=1.5in,top=0.5in,
includehead,includefoot]{geometry}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{multirow,hhline}
\usepackage{tabularx}
\usepackage{ragged2e} % for '\Centering' macro
% Define a centered version of 'X' column type:
\newcolumntype{C}{>{\Centering}X}
% or: \newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\textwidth}{|*{5}{C|}} % <-- "C", not "X"
\hline
\rowcolor[gray]{0.95}
\multicolumn{5}{|c|}{\texttt{tabularx} with default value of \texttt{\string\tabcolsep}}
\\ \hline
\textsf{Day 1}
& \textsf{Day 2} & \textsf{Day 3} & \textsf{Day 4} & \textsf{Day 5}
\\ \hhline{|=|=|=|=|=|}
Text 1 & Text 2 & Text 3 & Text 4 & Text 5 \\
12h00 to 18h00 & 12h00 to 18h00 & 12h00 to 18h00 & 12h00 to 18h00 & 12h00 to 18h00
\\ \hline
\end{tabularx}
\bigskip
\setlength\tabcolsep{3pt} % default value: 6pt
\begin{tabularx}{\textwidth}{|*{5}{C|}} % <-- "C", not "X"
\hline
\rowcolor[gray]{0.95}
\multicolumn{5}{|c|}{\texttt{tabularx} with reduced value of \texttt{\string\tabcolsep}}
\\ \hline
\textsf{Day 1}
& \textsf{Day 2} & \textsf{Day 3} & \textsf{Day 4} & \textsf{Day 5}
\\ \hhline{|=|=|=|=|=|}
Text 1 & Text 2 & Text 3 & Text 4 & Text 5 \\
12h00 to 18h00 & 12h00 to 18h00 & 12h00 to 18h00 & 12h00 to 18h00 & 12h00 to 18h00
\\ \hline
\end{tabularx}
\end{center}
\end{document}
\documentclass[12pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage[dvipsnames,table]{xcolor}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{tabularx}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|c|c|c|c|c|}
\hline
\rowcolor[gray]{0.95}
\multicolumn{5}{|c|}{Title}
\\ \hline
\multicolumn{1}{|c|}{\textsf{Day 1}}
& \multicolumn{1}{c|}{\textsf{Day 2}}
& \multicolumn{1}{c|}{\textsf{Day 3}}
& \multicolumn{1}{c|}{\textsf{Day 4}}
& \multicolumn{1}{c|}{\textsf{Day 5}}
\\ \hhline{|=|=|=|=|=|}
\multicolumn{1}{|c|}{Text 1}
& \multicolumn{1}{c|}{Text 2}
& \multicolumn{1}{c|}{Text 3}
& \multicolumn{1}{c|}{Text 4}
& \multicolumn{1}{c|}{Text 5}
\\
\multicolumn{1}{|c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
& \multicolumn{1}{c|}{12h00 to 18h00}
\\ \hline
\end{tabular}
\end{center}
\end{document}