tables add tag
Laurenso
I want to make a couter for the enviroment `Problem` for this table. I copy this lines from manual
```
\newcounter{mycnta}
\newcommand{\mycnta}{\stepcounter{mycnta}\arabic{mycnta}}
```
My code 

```
\documentclass[12pt]{article}
\usepackage{tabularray}
\UseTblrLibrary{diagbox}
\UseTblrLibrary{varwidth}
\UseTblrLibrary{booktabs}
\UseTblrLibrary{counter}
\usepackage{enumitem}
\usepackage{ninecolors}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}
\UseTblrLibrary{siunitx} 
\usepackage[paperwidth=19cm, paperheight=26.5cm, left=1.7cm,right=1.7cm,top=1.8cm,bottom=1.7cm]{geometry}
\DefTblrTemplate{contfoot-text}{normal}{Continued on next page}
\SetTblrTemplate{contfoot-text}{normal}
\DefTblrTemplate{conthead-text}{normal}{(Continued)}
\SetTblrTemplate{conthead-text}{normal}
\SetTblrTemplate{conthead-text}{normal}
\newcounter{mycnta}
\newcommand{\mycnta}{\stepcounter{mycnta}\arabic{mycnta}}
\begin{document}
	\begin{longtblr}[
caption={Some text}]{
colspec = {Q[c,gray9]X[l]Q[c]},
vlines,
hlines,
row{1}={yellow9},
cell{2}{2-3} ={teal9},
cell{7}{2-3} ={teal9},
cell{11}{2-3} ={teal9},
hline{1,2,Y,Z} = {solid},
cell{1}{2-3}={halign=c},
}
	\textbf{Problem} & \textbf{Content} & \textbf{Point} \\
		\SetCell[r=5]{m}	\textbf{\mycnta} & Solve the equation $ x^2 - 5x + 6 = 0 $ &  \num{1.00}   \\
		& $ \Delta =(-5)^2 - 4 \cdot 1 \cdot 6 = 1$, & \num{0.25} \\
		& $ x = \dfrac{-(-5) -1}{2} = 2$. & \num{0.25} \\
		& $ x = \dfrac{-(-5)  + 1}{2} = 3$ & \num{0.25} \\
		& The given equation has two solutions $x=2$ and $x = 3$. & \num{0.25} \\
		
		\SetCell[r=4]{m}	\textbf{\mycnta} & Find the derivaty of the function $ y = \dfrac{2x+1}{x-2} $ &  \num{0.75}  \\
		& $ y' = \dfrac{(2x+1)'(x-2)-(2x+1)(x-2)'}{(x-2)^2}$. & \num{0.25} \\
		& $ y'=\dfrac{2(x-2) -(2x+1)}{(x-2)^2}$. & \num{0.25} \\
		& $y'=-\dfrac{5}{(x-2)^2}$. & \num{0,25} \\
	\SetCell[r=3]{m}	\textbf{\mycnta} & Is this $ x^2 + 3x +4 >0$ true or fail? why?  &  \num{0.75}  \\
&  $ x^2 + 3x +4 >0$ true. & \num{0.25} \\
& $ x^2 + 3x +4 $ have $ \Delta = -7<0 $ and coefficient of  $ x^2 $ is $ 1 >0$. & \num{0.50}
\end{longtblr} 
\end{document}
```

![image.png](/image?hash=b12dd9e85960f554494ddc34f00625a03e62efa03a9b8eec899a14c18ddb4082)

What is another way to make it? 
Top Answer
samcarter
You could make your life a bit easier by using `cell{2-Z}{1}={cmd={\mycnta}}` which will automatically insert your macro in the first column:

```
\documentclass[12pt]{article}
\usepackage{tabularray}
\UseTblrLibrary{diagbox}
\UseTblrLibrary{varwidth}
\UseTblrLibrary{booktabs}
\UseTblrLibrary{counter}
\usepackage{enumitem}
\usepackage{ninecolors}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{siunitx}
\sisetup{output-decimal-marker={,}}
\UseTblrLibrary{siunitx} 
\usepackage[paperwidth=19cm, paperheight=26.5cm, left=1.7cm,right=1.7cm,top=1.8cm,bottom=1.7cm]{geometry}
\DefTblrTemplate{contfoot-text}{normal}{Continued on next page}
\SetTblrTemplate{contfoot-text}{normal}
\DefTblrTemplate{conthead-text}{normal}{(Continued)}
\SetTblrTemplate{conthead-text}{normal}
\SetTblrTemplate{conthead-text}{normal}
\newcounter{mycnta}
\newcommand{\mycnta}{\stepcounter{mycnta}\arabic{mycnta}}
\begin{document}
	\begin{longtblr}[
caption={Some text}]{
colspec = {Q[c,gray9]X[l]Q[c]},
vlines,
hlines,
row{1}={yellow9,font=\bfseries},
cell{2}{2-3} ={teal9},
cell{7}{2-3} ={teal9},
cell{11}{2-3} ={teal9},
hline{1,2,Y,Z} = {solid},
cell{1}{2-3}={halign=c},
column{1}={font=\bfseries},
cell{2-Z}{1}={cmd={\mycnta}},
}
	Problem & Content & Point \\
	\SetCell[r=5]{m}	& Solve the equation $ x^2 - 5x + 6 = 0 $ &  \num{1.00}   \\
		& $ \Delta =(-5)^2 - 4 \cdot 1 \cdot 6 = 1$, & \num{0.25} \\
		& $ x = \dfrac{-(-5) -1}{2} = 2$. & \num{0.25} \\
		& $ x = \dfrac{-(-5)  + 1}{2} = 3$ & \num{0.25} \\
		& The given equation has two solutions $x=2$ and $x = 3$. & \num{0.25} \\
	\SetCell[r=4]{m}	& Find the derivaty of the function $ y = \dfrac{2x+1}{x-2} $ &  \num{0.75}  \\
		& $ y' = \dfrac{(2x+1)'(x-2)-(2x+1)(x-2)'}{(x-2)^2}$. & \num{0.25} \\
		& $ y'=\dfrac{2(x-2) -(2x+1)}{(x-2)^2}$. & \num{0.25} \\
		& $y'=-\dfrac{5}{(x-2)^2}$. & \num{0,25} \\
	\SetCell[r=3]{m}	& Is this $ x^2 + 3x +4 >0$ true or fail? why?  &  \num{0.75}  \\
&  $ x^2 + 3x +4 >0$ true. & \num{0.25} \\
& $ x^2 + 3x +4 $ have $ \Delta = -7<0 $ and coefficient of  $ x^2 $ is $ 1 >0$. & \num{0.50}
\end{longtblr} 
\end{document}
```

![Screenshot 2023-01-29 at 12.27.50.png](/image?hash=acff3e92ee3d592977720b15b7c521beb4893435e769551a434e516b87e6f732)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.