3

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

  • Try the 'tabu' package, it handles lines much better than other packages. Read the documentation for 'booktabs' and get rid of the vertical lines. – Sveinung Aug 25 '14 at 17:48
  • I don't know if tabu is a good Idea, I found this tex.stackexchange.com/questions/121841/… Also the document is very long and only consists of tables. I mean if there is no other way I have to use tabu but in first place I'm looking for an "easy" solution. – Hemeroc Aug 25 '14 at 17:58
2

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.

| improve this answer | |
  • Thanks your solution works great in expanding the row height but in one case I need smaller row height. – Hemeroc Aug 26 '14 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.