0

I'm trying to make a table (matrix in tikz) in which some rows must have a slightly reduced or increased font size. In my mwe i used relsize but it is not suitable here as it adjusts relatively to the document's current font size, not the font size set in the node options. Therefore since i used \Large i should get \large with \smaller, but i get \small.

\documentclass[a4paper]{article}
\usepackage{tikz,resize}
\usetikzlibrary{matrix}
\tikzset{
  texttable/.style 2 args={column sep=-\pgflinewidth,
        nodes={anchor=center, text width=#1, outer sep=0pt},
        every odd row/.style={font=#2}},
        every even row/.style={font=\smaller,},}

\begin{document}
\begin{tikzpicture}
\matrix at (0,0) [matrix of nodes, nodes in empty cells,
    texttable={60mm}{\Large}, align=right] (tb1)
    {
    abc\\
    def\\
    ghi\\
    jkl\\};
\end{document}
\end{tikzpicture}

1 Answer 1

0

State #2\smaller.

\documentclass[a4paper]{article}
\usepackage{tikz,relsize}
\usetikzlibrary{matrix}

\tikzset{
  texttable/.style 2 args={
    column sep=-\pgflinewidth,
    nodes={anchor=center, text width=#1, outer sep=0pt},
    every odd row/.style={font=#2},
    every even row/.style={font=#2\smaller},
  },
}

\begin{document}

\begin{tikzpicture}
\matrix at (0,0) [
  matrix of nodes,
  nodes in empty cells,
  texttable={60mm}{\Large},
  align=right
] (tb1)
{
  abc\\
  def\\
  ghi\\
  jkl\\
};
\end{tikzpicture}

\end{document}

enter image description here

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.