# Change font tabular for a specific row

I am using tabular to create a table in latex. You can see my work below:

In this I need to change the font for the 2nd row to Courier font.

How can I achieve this. I do not want to change the font for the rest of the rows, specially the header.

Thanks!

My Work:

\documentclass{article}
\usepackage{multirow}
\usepackage{xcolor}
\usepackage{color, colortbl}
\begin{document}

\begin{table}[h]
\centering
\small
\begin{tabular}{|c|c|l|l|}
\hline
\rowcolor[HTML]{CACFD2}
\multirow{2}{*}{A}  & Col2 & ABCDE (Row1) \\ \cline{2-3}
& Col2 & ABCDE (Row2) \\    \hline
B                   & Col2 & ABCDE (Row3)\\ \hline
\end{tabular}
\end{table}

\end{document}


Adding \texttt at row level didn't work. See below

\documentclass{article}
\usepackage{multirow}
\usepackage{xcolor}
\usepackage{color, colortbl}
\begin{document}

\begin{table}[h]
\centering
\small
\begin{tabular}{|c|c|l|l|}
\hline
\rowcolor[HTML]{CACFD2}
\texttt{\multirow{2}{*}{A}  & Col2 & ABCDE (Row1)} \\ \cline{2-3}
\texttt{\& Col2 & ABCDE (Row2)} \\    \hline
\texttt{\B                   & Col2 & ABCDE (Row3)}\\ \hline
\end{tabular}
\end{table}


\end{document}

Adding \texttt at every cell level worked.

\documentclass{article}
\usepackage{multirow}
\usepackage{xcolor}
\usepackage{color, colortbl}
\begin{document}

\begin{table}[h]
\centering
\small
\begin{tabular}{|c|c|l|l|}
\hline
\rowcolor[HTML]{CACFD2}
\multirow{2}{*}{\texttt{A}}  & \texttt{Col2} & \texttt{ABCDE (Row1)} \\ \cline{2-3}
& \texttt{Col2} & \texttt{ABCDE (Row2)} \\    \hline
\texttt{B}                   & \texttt{Col2} & \texttt{ABCDE (Row3)}\\ \hline
\end{tabular}
\end{table}


\end{document}

## Output

• Please extend your piece of code to a MWE. What engine are you using? Mar 17 '17 at 16:32
• "I need to change the font". Would this be the font size, weight, shape, or family? Or all of the above? Or something completely different maybe? Don't expect to find accomplished mind readers on this site. I'm afraid you'll be sorely disappointed if you do...
– Mico
Mar 17 '17 at 16:37
• You can place your font commands inside each cell of the tabular. Mar 17 '17 at 16:40
• I tried to use \texttt at the row level, it didn't work. But if I use it before begin{tabular} then it works. Mar 17 '17 at 16:47
• please show us what did not work. You will get much more help here if you extend your code to make a complete document that people here can just cut and paste locally and compile. Mar 17 '17 at 17:11

Just use \texttt separately around each cell. a table cell is a group like {...} so there is no natural way to start a font change in the first cell in a row and make it last for the whole row.

With {NiceTabular} of nicematrix, you have a command \RowStyle to specify formatting instructions for the current row.

\documentclass{article}
\usepackage{xcolor}
\usepackage{nicematrix}

\begin{document}

\begin{table}[h]
\centering
\small
\begin{NiceTabular}{ccl}[hvlines,colortbl-like]
\rowcolor[HTML]{CACFD2}
\RowStyle{\bfseries}

The key hvlines draws all the rules.