# Row with different column width

I am able to create basic tables, but never really gotten in depth with them. I am trying to recreate the table (see pic). I am unable to do so. I think I need to use multicol or row. Here is my doc:

\documentclass[11pt,letterpaper]{article}
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{fourier}
\usepackage{caption}
\usepackage[dvipsnames]{xcolor}
\usepackage[utf8]{inputenc}
\let\circledS\undefined
\usepackage{tabularx,booktabs}

\usepackage[top=1cm, bottom=4.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{multicol,fancyhdr,fullpage,setspace,parskip,float}

% HEADER AND FOOTER
\newcommand\course{AP Calculus BC}
\pagestyle{fancy}
\lhead{\textbf{Skill Builder: Topics 2.1-2.3 -  The Definition of the Derivative}}
\lfoot{Mr. Bennett}
\cfoot{Flint Hill Upper School}
\rfoot{\small\thepage}

\begin{document}

Compute the derivative function $$f^\prime\left(x\right)$$, using the definition of derivative for each of the following.  \textbf{\underline{Use proper notation}}.\\

\begin{tabular}{|p{0.7\textwidth}|p{0.3\textwidth}|}
\hline
1.  $$f(x)=-2x^2+1$$    & 2. $$f(x)=3$$ \\[2in] \hline
3.  $$f\left(x\right)=\dfrac{2}{x+1}$$ & \\[2in] \hline

\end{tabular}

\end{document}



I FOUND IT!!!!!!!

Well I am not sure this is the "best way"

 \begin{tabular}{|p{0.7\textwidth}|p{0.3\textwidth}|}
\hline
1.  $$f(x)=-2x^2+1$$    & 2. $$f(x)=3$$ \\[2in] \hline

\multicolumn{2}{|l|}{$$f\left(x\right)=\dfrac{2}{x+1}$$} \\[2in] \hline

\end{tabular}

• Your table is wider than width of text area on page. It protrude out of the its right border. Commented Aug 31, 2023 at 14:11

I'd use array features.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}

\newcolumntype{P}[2]{%
p{\dimeval{#1\textwidth-2\tabcolsep-#2\arrayrulewidth}}<{\prespace{-2pt}}%
}

\begin{document}

\noindent X\dotfill X% to see the margins

\begin{center}

\begin{tabular}{|P{0.7}{1.5}|P{0.3}{1.5}|}
\hline
1.  $$f(x)=-2x^2+1$$    & 2. $$f(x)=3$$ \\[2in] \hline
\multicolumn{2}{|P{1}{2}|}{$$f(x)=\dfrac{2}{x+1}$$} \\[2in]
\hline
\end{tabular}

\end{center}

\end{document}


Note that this produces a table exactly as wide as the text block.

The \prespace trick moves the formulas a little down.

• For some reason, your code does not run Commented Aug 31, 2023 at 19:04
• @NickB Works for me. What error do you get? Commented Aug 31, 2023 at 20:26

I suggest to use tblr of tabularray table. With employing it the table code become simple:

\documentclass[11pt,letterpaper]{article}
\usepackage[hmargin=25mm, vmargin={1cm,4.5cm}]{geometry}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                             % for dummy text
%---------------------------------------------------------------%

\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{fourier}

\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs}

\begin{document}

Compute the derivative function $$f'(x)$$, using the definition of derivative for each of the following.  \textbf{\underline{Use proper notation}}.\\

\noindent\begin{tblr}{hlines, vlines,
colspec = {X[0.6, l, h, mode=math] X[0.4, l, h, mode=math]},
hspan   = minimal,
rows    = {32mm},
rowsep  = 5pt
}
1.\ f(x) = -2x^2+1         &  2.\ f(x)=3  \\
\SetCell[c=2]{}
3.\ f(x) = \dfrac{2}{x+1} &               \\
\end{tblr}
\end{document}


(red lines indicate text area borders)

• Hi @zarko, your code still has text past the table when I run it. No idea why Commented Aug 31, 2023 at 19:07
• @NickB sorry, I don't understand you. What is the problem? My MWE works. If you like to have higher cell, increase its height defined in rows = {33mm} for example with rows = {2in}, if you like to have bigger distance between (task?) numbers in cells and math terms, instead of \  insert for example \quad . Please elaborate your comment! Commented Aug 31, 2023 at 20:06