无法调整 tabularx 的大小?

无法调整 tabularx 的大小?

我对 TeX 还很陌生,似乎无法弄清楚为什么这个表格没有调整大小。

我尝试过网上其他帖子中的几种不同的解决方案,但似乎没有什么效果。

\usepackage{tabularx}
\usepackage{hhline}

\begin{table}[h!]
    \begin{center}
        \setlength\doublerulesep{0.5pt}
        \begin{tabularx}{\textwidth}{ || l | l | l || }
        \hhline{|==|}
        \textbf{What will be measured} & \textbf{Why is it being measured} 
        & \textbf{How is it being measured}\\
            \hhline{|==|}

        High fps camera footage. & Have a visual record of the secondary 
        mission events. & Using the bridgetek CleO-CAM1 camera module.\\
        \hhline{|--|}
        Barometric pressure, temperature, humidity and environmental gasses. & 
        For telemetry to base station, fulfilling primary mission. & Via a 
        PCB-integrated Bosch BME680.\\
        \hhline{|--|}
        Vrms across secondary mission inductor coils. & For power calculations
        and analysis from base station. & A non-inverting amplifier used 
        to proportionally increase voltage output. A high resolution 
        linear ADC reads voltage.\\
        \hhline{|--|}
        GPS coordinates. & To aid cansat tracking. & The MTK3339 GPS 
        is mounted to the main PCB and wired to a dedicated antenna 
        on the side of the cansat.\\
        \hhline{|--|}
        Rotation, acceleration and relative position. & Additional data to aid
        primary and secondary mission. & FXOS8700 + FXAS21002 9DOF
        module soldered to the main PCB.\\
        \hhline{|--|}
        Vibrations. & Data for secondary mission power generation 
        performance. & Mechanical vibration sensor with accelerometer 
        from 9DOF package.\\
        \hhline{|--|}
        3D magnetic field strength. & Data for secondary mission efficiency
        analysis. & 3 Honeywell SS400 Series hall effect sensors aligned 
        to 3 independent axes.\\
        \hhline{|--|}
        Rms current generated by secondary mission inductor coils. & For 
        power calculations and analysis from base station. & ACS712ELC in
        series with each inductor coil.\\
        \hhline{|==|}
        \end{tabularx}
    \end{center}
\end{table}

这给出了以下输出,该输出无法水平放置在 A4 纵向页面上:

输出表

答案1

您的代码不允许自动换行。由于您正在使用环境,因此对于所有三列,tabularx您确实应该使用X列类型而不是列类型。l

我还想鼓励您为表格添加更多“开放”的材料,方法是 (a) 省略所有垂直线,(b) 使用更少的水平线,以及 (c) 使用包的宏来booktabs绘制剩余的几条水平线。不再使用\hline\hhline指令...请注意,空白与黑线一样有效,可以创建视觉分隔。

您的读者将会欣赏表格的开放式外观 - 而且他们很可能会花时间阅读和吸收表格的内容来奖励您的努力。:-)

在此处输入图片描述

\documentclass{article}
\usepackage[english]{babel}
\usepackage{tabularx,booktabs,ragged2e}
\newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
\usepackage[letterpaper,margin=1in]{geometry} % set page block parameters suitably

\begin{document}
% just for this example...
\setcounter{section}{2}
\setcounter{subsection}{2}
\setcounter{subsubsection}{1}
\subsubsection{What will be measured, why, and how?}

\begin{table}[h!]
\setlength{\tabcolsep}{4pt} % default value: 6pt
%% \centering % not needed since "tabularx" occupies full width of text block
\begin{tabularx}{\textwidth}{@{} YYY @{}}
        \toprule
        \textbf{What will be measured} & 
        \textbf{Why is it being measured} & 
        \textbf{How is it being measured}\\
        \midrule

        High fps camera footage. 
        & Have a visual record of the secondary mission events. 
        & Using the bridgetek CleO-CAM1 camera module.\\

        \addlinespace
        Barometric pressure, temperature, humidity and environmental gasses. 
        & For telemetry to base station, fulfilling primary mission. 
        & Via a PCB-integrated Bosch BME680.\\

        \addlinespace
        Vrms across secondary mission inductor coils. 
        & For power calculations and analysis from base station. 
        & A non-inverting amplifier used to proportionally increase voltage output. A high resolution linear ADC reads voltage.\\

        \addlinespace
        GPS coordinates. 
        & To aid cansat tracking. 
        & The MTK3339 GPS is mounted to the main PCB and wired to a dedicated antenna on the side of the cansat.\\

        \addlinespace
        Rotation, acceleration and relative position. 
        & Additional data to aid primary and secondary mission. 
        & FXOS8700 + FXAS21002 9DOF module soldered to the main PCB.\\

        \addlinespace
        Vibrations. 
        & Data for secondary mission power generation performance. 
        & Mechanical vibration sensor with accelerometer from 9DOF package.\\

        \addlinespace
        3D magnetic field strength. 
        & Data for secondary mission efficiency analysis. 
        & 3 Honeywell SS400 Series hall effect sensors aligned to 3 independent axes.\\

        \addlinespace
        Rms current generated by secondary mission inductor coils. 
        & For power calculations and analysis from base station. 
        & ACS712ELC in series with each inductor coil. \\
        \bottomrule
\end{tabularx}
\end{table}
\end{document} 

相关内容