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}
\textbf{Header 1} & \textbf{Header 2} & \textbf{Header 3} \\ \hline
\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}
\textbf{Header 1} & \textbf{Header 2} & \textbf{Header 3} \\ \hline
\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}
\textbf{Header 1} & \textbf{Header 2} & \textbf{Header 3} \\ \hline
\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}
Best Answer
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.