我\overrightarrow
在 tabularx 表格中使用了\hline
。但是,矢量箭头与线混合在一起。有没有好的除了手动添加间距之外,还有什么方法可以修复此错误?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
\begin{tabularx}{\linewidth}{|Y|Y|Y|}\hline
a&$\overrightarrow{\mathrm{AB}}$&c\\\hline
\end{tabularx}
\end{document}
答案1
该软件包的替代方案cellspace
:
\documentclass{article}
\usepackage{cellspace}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\setlength\cellspacetoplimit{6pt}
\setlength\cellspacebottomlimit{6pt}
\begin{document}
\begin{tabularx}{\linewidth}{|Y|SY|Y|}\hline
a & $\overrightarrow{\mathrm{AB}}$ & cdeffg \\\hline
\end{tabularx}
\end{document}
答案2
另一种可能性是使用\makegapedcells
包makecell
:
\documentclass{article}
\usepackage{amsmath, amssymb}
\usepackage{makecell, tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
{
\setcellgapes{3pt}
\makegapedcells
\begin{tabularx}{\linewidth}{|Y|Y|Y|}\hline
a & $\overrightarrow{\mathrm{AB}}$ & cdeffg \\\hline
\end{tabularx}
}
\end{document}
答案3
您可以使用\renewcommand{\arraystretch}{<more space between rows>}
(或与@Zarko'definition拉伸因子),例如增加细胞的空间。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\begin{document}
{\renewcommand{\arraystretch}{2}
\begin{tabularx}{\linewidth}{|Y|Y|Y|}\hline
a&$\overrightarrow{\mathrm{AB}}$&c\\\hline
\end{tabularx}}
\end{document}