具有不同列宽的行

具有不同列宽的行

我可以创建基本表格,但从未真正深入了解过它们。我正在尝试重新创建表格(见图)。我无法做到这一点。我想我需要使用多列或行。这是我的文档:

\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}
\headheight 35pt
\lhead{\textbf{Skill Builder: Topics 2.1-2.3 -  The Definition of the Derivative}}
\chead{\textbf{}}
\rhead{\course \\ \today}
\lfoot{Mr. Bennett}
\cfoot{Flint Hill Upper School}
\rfoot{\small\thepage}
\headsep 1.5em


\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}

在此处输入图片描述

答案1

我找到了!!!!!!!

嗯,我不确定这是不是“最好的方法”

 \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}

答案2

我会使用array功能。

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

\newcommand{\prespace}[1]{\vadjust pre{\vspace{#1}}}
\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}

请注意,这将生成一个与文本块宽度完全相同的表格。

这个\prespace技巧将公式稍微向下移动了一点。

在此处输入图片描述

答案3

我建议使用tblr表格tabularray。使用它,表格代码变得简单:

\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}

在此处输入图片描述

(红线表示文本区域边框)

相关内容