
Posso fazer esse tipo de tabela em LaTeX?
Eu gostaria de aplicar as respostas a esta tabela:
\documentclass[10pt]{article}
\usepackage[left=1cm,right=1.5cm,top=1cm, bottom=3.5cm]{geometry}
\begin{document}
\begin{tabular}{|l|l|l|}
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
text & text & text \\
\hline
\end{tabular}
\end{document}
Responder1
Sentindo que é mais parecido com uma imagem, codifiquei-a em TikZ
:
\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}[tp/.style={minimum height=6cm+2\pgflinewidth,minimum width=1cm,fill=white},line width=1pt]
\node[minimum size=6cm,inner sep=0pt,draw] (big) {};
\draw (big.180)--(big.0)(big.90)--(big.-90);
\node[tp] at ($(big.center)!.5!(big.0)$) {};
\node[tp] at ($(big.center)!.5!(big.180)$) {};
\node[tp,rotate=90] at ($(big.center)!.5!(big.90)$) {};
\node[tp,rotate=90] at ($(big.center)!.5!(big.-90)$) {};
\end{tikzpicture}
\end{document}
Além disso, adicionar texto não pode ser mais fácil!
Veja este exemplo:
\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}[BL/.style={draw=blue,line width=1cm,shorten >=-1pt,shorten <=-1pt},line width=1pt]
\node[minimum size=6cm,inner sep=0pt,draw] (big) {};
\draw (big.180)--(big.0)(big.90)--(big.-90);
\draw[BL]($(big.90)!.5!(big.135)$)--($(big.-90)!.5!(big.-135)$);
\draw[BL]($(big.90)!.5!(big.45)$)--($(big.-90)!.5!(big.-45)$);
\draw[BL]($(big.180)!.5!(big.135)$)--node[pos=.25,fill=white]{Cell no. 11}node[pos=.75,fill=white]{Cell no. 12}($(big.0)!.5!(big.45)$);
\draw[BL]($(big.180)!.5!(big.-135)$)--node[pos=.25,fill=white]{Cell no. 21}node[pos=.75,fill=white]{Cell no. 22}($(big.0)!.5!(big.-45)$);
\end{tikzpicture}
\end{document}
Atualizar
Quanto à versão final editada da questão, aqui está outra TikZ
implementação que aceita qualquer tamanho de tabela:
\documentclass[10pt]{article}
\usepackage{tikz,colortbl}
\usetikzlibrary{positioning,calc}
\begin{document}
\newcommand{\mytable}[1]{\ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
text & text & text \\ \ifnum#1>0\hline\else\fi
}
\newcolumntype{W}{>{\color{white}}l}
\begin{tikzpicture}[shorten >=-1pt,shorten <=-1pt]
\node[draw,inner sep=0pt](table){%
\begin{tabular}{|W|W|W|}
\mytable{1}
\end{tabular}};
\foreach \x in {1,3,5}
\draw[white,line width=.3cm] ($(table.north west)!\x/6!(table.north east)$)--($(table.south west)!\x/6!(table.south east)$);
\foreach \x in {1,3,...,23}
\draw[white,line width=.1cm] ($(table.north west)!\x/24!(table.south west)$)--($(table.north east)!\x/24!(table.south east)$);
\setlength{\extrarowheight}{.4pt}
\node at (table.center){\noindent%
\begin{tabular}{lll}
\mytable{0}
\end{tabular}};
\end{tikzpicture}
\end{document}
O primeiro \foreach
faz um loop sobre números ímpares de 1
até 2*#columns-1
e o segundo \foreach
faz um loop sobre números ímpares de 1
até 2*#rows-1
. Além disso, \x/6
são múltiplos da largura de meia coluna e \x/24
da altura de meia linha. As linhas da tabela são inseridas no \mytable
comando apenas uma vez.
Responder2
Aqui eu faço minha própria macro \Dcell[]
, que será usada como componente de um TABstack, para criar a tabela. Admito a possibilidade de adicionar texto aos elementos com o argumento opcional to \Dcell
. Existem 3 parâmetros de usuário na parte superior do arquivo:
\rlwd
a largura das regras de canto
\rlln
o comprimento das regras de canto
\cellhgap
o espaço vazio entre as duas réguas de canto (o espaço vertical se ajusta automaticamente para manter a célula quadrada).
Obviamente, \cellhgap + 2\rlln
deve exceder a entrada de texto mais larga.
Embora haja um pouco de configuração de preâmbulo, o uso real é bastante trivial.
\documentclass{article}
\usepackage{tabstackengine}
\def\rlwd{.4pt}
\def\rlln{3ex}
\def\cellhgap{3ex}
\def\cellfield{\dimexpr\cellhgap + 2\dimexpr\rlln}
\def\cellvgap{.5\dimexpr\cellhgap-\ht\strutbox\relax}
\setstackEOL{\cr}
\setstackgap{S}{-\rlwd}
\fixTABwidth{T}
\newcommand\Dcell[1][]{\protect\Dcellraw{#1}}
\newcommand\Dcellraw[1]{%
\stackunder[\cellvgap]{%
\stackon[\cellvgap]{\makebox[\cellfield]{\strut#1}}{%
\rule[\dimexpr-\rlln+\rlwd\relax]{\rlwd}{\rlln}\rule{\rlln}{\rlwd}%
\hspace{\cellhgap}%
\rule{\rlln}{\rlwd}\rule[\dimexpr-\rlln+\rlwd\relax]{\rlwd}{\rlln}}%
}{%
\rule{\rlwd}{\rlln}\rule{\rlln}{\rlwd}%
\hspace{\cellhgap}%
\rule{\rlln}{\rlwd}\rule{\rlwd}{\rlln}%
}\kern-\dimexpr\rlwd%
}
\begin{document}
\tabbedShortstack{
\Dcell[xyz]&\Dcell\cr
\Dcell[z]&\Dcell[abcdefg]
}
\end{document}