如何强制表格保持边距

如何强制表格保持边距

我使用 LaTeX 创建了一个表格,但如图所示,表格宽度也延伸到了页面宽度。我想保留页面中的边距。

我怎样才能做到这一点?

代码

\begin{tabular}{ |l|l| }
 \hline
 \multicolumn{2}{|c|}{Symbols Directory} \\
 \hline
 $A$ & is the state transition matrix in Kalman Filter and it is a square   
 matrix of nxn \\
 $\textbf{x}_\textbf{k}$ & is the state vector in Kalman Filter with nx1     
 dimension \\
  $B$ & is the control matrix  in Kalman Filter and it is of dimension mxn   
  \\
 $\textbf{u}$ & is the control vector  in Kalman Filter and it is of 
 dimension mx1 \\
 $w$ & process noise ”error source”  in Kalman Filter and it is of nx1   
 dimension \\
 $P_k$ & is the estimated covariance matrix  in Kalman Filter with nxn   
 dimension \\
  $Q$ & is the process noise covariance matrix  in Kalman Filter with nxn  
 dimension \\
 $R$ & is the measurement noise covariance matrix  in Kalman Filter with mxm 
 dimension \\
 $\hat{x}k$ & is the adjusted or the corrected state variables  in Kalman 
 Filter with nx1 dimension \\
 $K$ & is Kalman gain in Kalman Filter \\
 $\bigtriangleup{T}$ & The traveling time spans from the GPS signal emission  
 till the GPS reception\\
 $t_r$ & Time at which the GPS signal received\\
 $t_e$ & Time at which the GPS signal emitted\\

 \hline
 \end{tabular}

在此处输入图片描述

答案1

我会这样做,使用tabularx。在我看来,这是一个垂直规则更受欢迎的情况。我将第一列的对齐方式更改为r,并使用showframe选项geometry检查每行是否适合边距:

\documentclass[a4paper, x11names]{article}
\usepackage[showframe]{geometry}
\usepackage{array, tabularx}
\usepackage[table, x11names]{xcolor}

\begin{document}

\setlength\extrarowheight{3pt}
\noindent\begin{tabularx}{\linewidth}{r!{\enspace\color{Grey0!70!RoyalBlue1!50!}\vrule width1.2pt\enspace}X }

\multicolumn{2}{c}{\itshape Symbols Directory} \\[1.5ex]
$A$ & is the state transition matrix in Kalman Filter and it is a square
matrix of $ n × n $ \\
$\mathbf{x_k}$ & is the state vector in Kalman Filter with $ n × 1 $ dimension \\
$B$ & is the control matrix in Kalman Filter and it is of dimension $m × n $ \\
$\textbf{u}$ & is the control vector in Kalman Filter and it is of
dimension $ m × 1 $ \\
$w$ & process noise ”error source” in Kalman Filter and it is of $ n × 1 $
dimension \\
$P_k$ & is the estimated covariance matrix in Kalman Filter with $ n × n $ dimension \\
$Q$ & is the process noise covariance matrix in Kalman Filter with $ n × n $ dimension \\
$R$ & is the measurement noise covariance matrix in Kalman Filter with $ m × m $ dimension \\
$\hat{x}k$ & is the adjusted or the corrected state variables in Kalman
Filter with $ n × 1 $ dimension \\
$K$ & is Kalman gain in Kalman Filter \\
$\bigtriangleup{T}$ & The traveling time spans from the GPS signal emission
till the GPS reception\\
$t_r$ & Time at which the GPS signal received\\
$t_e$ & Time at which the GPS signal emitted
\end{tabularx}

\end{document} 

在此处输入图片描述

答案2

将该行改为\begin{tabular}{@{\extracolsep{\fill}} |l|p{11cm}|}并编译。第二列的宽度可以根据所需的右边距增加或减少。

相关内容