# Tabularx line break with long space between words [duplicate]

This question already has an answer here:

I'm a problem when using the package tabularx.

Here is how I use the table:

\documentclass{report}
\usepackage{tabularx}
\usepackage[margin=3.5cm]{geometry}

\begin{document}
\noindent \begin{tabular}[H]{|l|c|c|c|}
\hline
Simple text & A simple long text maybe very long or not i dont know c: & Simple text & Another simple long text maybe very long or not i dont know c:\\
\hline
\end{tabular}
\bigskip
\noindent\begin{tabularx}{\textwidth}{|c|X|X|X|}
\hline
Simple text & A simple long text maybe very long or not i dont know c: & Simple text & Another simple long text maybe very long or not i dont know c:\\

\hline
\end{tabularx}
\end{document}


I was using the the regular taular but I need to have auto linebreak. I get theses long space when he breaks line. How can I have normal space ?

Thanks in advance, MYT.

SOLUTION by leandriis
The 'long spaces' are due to X columns being based on justified p columns. To get rid of them you could define your own column type as follows:
\newcolumntype{Y}{>{\raggedright\arraybackslash}X}

## marked as duplicate by egreg, Bobyandbob, David Carlisle, user36296, Stefan PinnowFeb 2 '18 at 10:59

• The 'long spaces' are due to X columns being based on justified p columns. To get rid of them you could define your own column type as follows: \newcolumntype{Y}{>{\raggedright\arraybackslash}X}. I don't understand the part about the margin. If I use your MWE, the table spreads from the left to the right margin as expected. You can check that by including \usepackage{showframe}. – leandriis Feb 2 '18 at 7:59
• I eddited my post, I don't have problem with margin, it's just when I did the two table, I thought I had a problem with margin. Thank you , your solution works perfectly – mytDRAGON Feb 2 '18 at 8:03
• please do not edit the solution in to the question, it makes a mess of the question/answer format. You can post a solution as an answer. Also what is the intention of \begin{tabular}[H] tabular does not have an H option (it just ignores unknown options rather than give an error) – David Carlisle Feb 2 '18 at 10:44
• That's because I used it on the regular tabular, I didn't think to delete it – mytDRAGON Feb 2 '18 at 13:50