Tabular in a moderncv

Asked by Flo__

Hi,

it appears that it's not possible (i.e. no border, no spaces...) to include a tabular in a moderncv document (neither tabularx or array in math mode). I guess it's because some variables are modified in the style file of moderncv.

Any hint to override this?

Best,
F

Question information

Language:
English Edit question
Status:
Solved
For:
moderncv Edit question
Assignee:
Xavier Danaux Edit question
Solved by:
Flo__
Solved:
Last query:
Last reply:
Revision history for this message
Xavier Danaux (xdanaux) said :
#1

Hi Florian,

Any chance to include a simple example showing the error you get when trying to include a tabular? Moderncv uses tabulars extensively, so there should be no reason you can't use them yourself...

Kind regards,

Xavier

Revision history for this message
Flo__ (flooo) said :
#2

Hi,

thanks for the answer!

I don't have any compilation error, it's just that it doesn't render any tabular on the pdf.

For example, the following code :

$
\begin{array}{|c|c|c|}
\hline AA & BB & CC \\
\hline DD & EE & FF
\end{array}
$

\begin{tabular}{|c|c|c|}
\hline aa & bb & cc \\
\hline dd & ee & ff \\
\hline
\end{tabular}

Give : http://imageshack.us/photo/my-images/832/outz.png/

Best,
F

Revision history for this message
Xavier Danaux (xdanaux) said :
#3

Hi Florian,

The array and the tabular are actually rendered perfectly. If you would make the cell contents less similar, you would be able to see that the layout is perfectly rendered as requested.

You are not seeing any vertical line because you have not defined their width, hence they are rendered with a zero width...
What you are looking for, is to set \arrayrulewidth to a non-zero value. You might also want to similarly set \arraycolsep and \tabcolsep to non-zero values to create some space between the columns.

Kind regards,

Xavier

Revision history for this message
Flo__ (flooo) said :
#4

Hi,

Ooups, my bad. In the usual classes, i guess these values are not set to 0 by default.

To solve my problem, I just uncommented the following line of the cls file :
% TO BE TESTED
\setlength\arraycolsep{5\p@}
\setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{.4\p@}

Thanks !
F

Revision history for this message
Dimitrios Apostolou (jimis) said :
#5

Hello, can't this be fixed inside moderncv? I just spent one hour trying to find out what's wrong with my use of tabular, until I found the answer at [1]. Thanks.

[1] http://tex.stackexchange.com/questions/68334/why-tabular-doesnt-work-with-moderncv

Revision history for this message
Xavier Danaux (xdanaux) said :
#6

I just set \arrayrulewidth to its standard value of 0.4pt by default, but won't set \arraycolsep or \tabcolsep to non-zero values as of now / yet, as moderncv uses tabulars extensively and the code would need to be adapted to take those extra spaces into account.