[Tex/LaTex] Pattern background in table cell or minipage

backgroundstables

More than a code answer, I am asking for pointers. What packages should I look into to get something similar with the image? The hard part (I think) is the stripped background. The digit, then is just placement with white color. (btw, using XeLaTeX)

My Goal

Best Answer

I just want to point you to the patterns library of tikz. The following code and result could be a starter for you (BTW see here for similar question).

pattern

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns}

\begin{document}
\begin{tikzpicture}
\draw[fill=gray!50] (0,0) rectangle (4,2);
\draw[pattern=horizontal lines,pattern color=black] (0,0) rectangle (4,2);
\node[color=white,scale=8] at (2,1) {1};
\end{tikzpicture}

\end{document}

It seems it is not possible to change a pattern line width. But one can look into the pgf patterns file (pgflibrarypatterns.code.tex), copy the pattern definition, and change the line width:

\pgfdeclarepatternformonly{my horizontal lines}{\pgfpointorigin}{\pgfqpoint{100pt}{1pt}}{\pgfqpoint{100pt}{3pt}}% 
{
  \pgfsetlinewidth{1pt}
  \pgfpathmoveto{\pgfqpoint{0pt}{0.5pt}}
  \pgfpathlineto{\pgfqpoint{100pt}{0.5pt}}
  \pgfusepath{stroke}
}

and change the code above to use this pattern name (my horizontal lines).