[Tex/LaTex] hdashline with tabularx together with custom row height is not working

arydshlntabularx

I tried to set up a table with different custom row height and a dashed line.

I'm using tabularx for the table and arydshln for the dashed line.

When I import arydshline before tabularx it starts throwing errors and does not draw the dashed line correct, when I import tabularx before arydshline ruins the right and left table border.

\documentclass[letterpaper, 11pt]{article}

%\usepackage{arydshln} % Throws some errors and does not draw a correct line when placed here

\usepackage{tabularx}

%\usepackage{arydshln} % Ruins the left and right table border when placed here

\begin{document}

    \begin{table}[h!]
        \begin{tabularx}{\textwidth}{|X|X|X|X|} \hline

            \multicolumn{4}{|>{\hsize=4\hsize}X|}{}\\[-2ex]
            \multicolumn{3}{|>{\hsize=3\hsize}X}{\textbf{\Large 1}}  &
            \multicolumn{1}{>{\raggedleft}X|}{2} \\[1ex] % \hdashline % That is the dashed line i want to show

        \end{tabularx}
    \end{table}

\end{document}

The example is reduced to the minimum, sadly I need all those three things, dashedline, tables and custom row height.

Here are some pictures of the output:

Crapped dashed line:

crapped dashed line

Crapped table border:

enter image description here

Best Answer

My suggestion would be to use struts in order to space your rows rather than using a fixed-height break \\[<len>]. Here's an example of what I mean:

enter image description here

\documentclass{article}

\usepackage{tabularx,arydshln}

\begin{document}

\noindent
\begin{tabularx}{\textwidth}{|X|X|X|X|}
  \hline
  \multicolumn{3}{|>{\hsize=3\hsize}X}{\rule{1pt}{50pt}\textbf{\Large 1}} &
  \multicolumn{1}{>{\raggedleft}X|}{\rule[-20pt]{1pt}{20pt}2} \\
  \hdashline
\end{tabularx}

\end{document}

I've used \rule{<width>}{<height>} to place a strut on the baseline and \rule[<depth>]{<width>}{<height>} to place a strut at <depth> below the baseline. In the above example, you should use a <width> of 0pt, but I've used 1pt to emphasize the strut.

Related Question