Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a table and I want to make two cells of it full of parallel lines to show that there is no content in them. How can I do that?

A MWE is the following:

\documentclass[12pt]{article}

\usepackage{setspace}
\setlength{\parindent}{0cm}

\usepackage{xltxtra}
\usepackage{xgreek}
\setmainfont[Mapping=tex-text]{GFSDidot.otf}
\setsansfont[Mapping=tex-text]{GFSDidot.otf}

\usepackage{amsmath}

\everymath{\displaystyle}

\usepackage{booktabs}

\begin{document}

\begin{tabular}{|l|l|l|l|l|}
\hline
{} & \multicolumn{2}{|c|}{Κινητήρας} & \multicolumn{2}{|c|} {Γεννήτρια}\\
\hline
{} & Y & Δ & Υ & Δ\\
\hline
Cell 1 & $2$ & 2 & $2$ & $2$\\
\hline
Cell 2 & $25.477$ & $25.477$ & {} & {}\\ 
\hline
Cell 3 & $0.9823$ & $0.9765$ & {} & {}\\
\hline
\end{tabular}

\end{document}

The cells in question are the ones with the {}

Edit I: I had forgotten some words in Greek having deleted the code regarding language. I have edited it with these lines of code.

share|improve this question
1  
are you missing inputenc? Or do you assume xelatex or ?? –  David Carlisle May 1 at 12:16
    
    
I use xelatex sorry. –  Adam May 1 at 12:17
    
@HenriMenke I want a lot of parallel black lines to mean no content not to cross out the cell. –  Adam May 1 at 12:18
    
@Mico that is the code I use and compile. –  Adam May 1 at 12:28

3 Answers 3

\documentclass[12pt]{article}


%% \usepackage[utf8]{inputenc}
\usepackage{setspace}
\setlength{\parindent}{0cm}
\newcommand\zz{\mbox{}\kern-\tabcolsep\cleaders\hbox{\!=\!}\hfill\kern-\tabcolsep\mbox{}}
\usepackage{amsmath}

\everymath{\displaystyle}

\usepackage{booktabs}

\begin{document}

\begin{tabular}{|l|l|l|l|l|}
\hline
{} & \multicolumn{2}{|c|}{Κινητήρας} & \multicolumn{2}{|c|} {Γεννήτρια}\\
\hline
{} & Y & Δ & Υ & Δ\\
\hline
Cell 1 & $2$ & 2 & $2$ & $2$\\
\hline
Cell 2 & $25.477$ & $25.477$ & \zz & \zz\\ 
\hline
Cell 3 & $0.9823$ & $0.9765$ & \zz & \zz\\
\hline
\end{tabular}

\end{document}

enter image description here

share|improve this answer

A standard technique for indicating that a table cell is either empty or can't have meaningful content is to gray it out, i.e., to fill it in completely with a shade of gray. To do so in XeLaTeX, you could load the colortbl and xcolor packages and apply the instruction \cellcolor{gray} in the cells in question. If "gray" isn't dark enough, you could employ "darkgray", say.

enter image description here

% !TEX TS-program = xelatex
\documentclass[12pt]{article}
\usepackage{setspace}
\setlength{\parindent}{0cm}
\usepackage{fontspec}
\usepackage{xgreek}
\setmainfont[Mapping=tex-text]{GFSDidot.otf}
\setsansfont[Mapping=tex-text]{GFSDidot.otf}
\usepackage{amsmath}
\everymath{\displaystyle}
\usepackage{booktabs}

\usepackage[table]{xcolor} % load colortbl and xcolor packages
\begin{document}
\begin{tabular}{|l|l|l|l|l|}
\hline
\cellcolor{gray} & \multicolumn{2}{c|}{Κινητήρας} & \multicolumn{2}{c|} {Γεννήτρια}\\
\hline
\cellcolor{gray} & Y & Δ & Υ & Δ\\
\hline
Cell 1 & $2$ & 2 & $2$ & $2$\\
\hline
Cell 2 & $25.477$ & $25.477$ & \cellcolor{gray} & \cellcolor{gray}\\ 
\hline
Cell 3 & $0.9823$ & $0.9765$ & \cellcolor{gray} & \cellcolor{gray}\\
\hline
\end{tabular}
\end{document}
share|improve this answer

Here is my first take. It's not ideal because the length of the lines is hard coded as 4em at the moment and I would prefer to have this done automatically. Mabybe some TeXpert can improve on this. Otherwise it's quite simple.

\documentclass[12pt]{article}


\usepackage{booktabs}

\begin{document}

\def\l{\hbox{\vrule width 4em height 0.4pt}\kern1.8pt}
\def\x{\vbox{\kern4pt\l\l\l\l\l}}

\begin{tabular}{|l|l|l|l|l|}
\hline
{} & \multicolumn{2}{|c|}{One} & \multicolumn{2}{|c|} {Two}\\
\hline
{} & Y & $\Delta$ & Υ & $\Delta$ \\
\hline
Cell 1 & $2$ & 2 & $2$ & $2$\\
\hline
Cell 2 & $25.477$ & $25.477$ & \x & \x\\ 
\hline
Cell 3 & $0.9823$ & $0.9765$ & \x & \x\\
\hline
\end{tabular}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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