스트레칭 테이블

스트레칭 테이블

다양한 실험을 위해 수행해야 하는 테이블을 생성하기 위해 사용자 정의 명령을 정의했습니다.

\newcommand{\exptable}[3]{
\begin{center}
    \renewcommand{\arraystretch}{1.5}
    \begin{tabular}{ccc}
        \hline 
        Particle & Voltage & Flow rate \\ 
        \hline 
        #1&\SI{#2}{\volt}&\SI{#3}{\micro\liter\per\minute}  \\ 
        \hline 
    \end{tabular}
\end{center}
}

이것은 훌륭하게 작동하지만 테이블은 입력에 따라 너비가 다릅니다. 입력한 것보다 최소 너비가 더 커지도록 변경하여 항상 동일한 너비(예: 7cm 또는 내가 설정할 수 있는 값)를 갖도록 하고 싶습니다.

답변1

이 같은?

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{array,siunitx}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcommand{\exptable}[4]{%
\begin{center}
    \sisetup{per-mode=symbol}
    \renewcommand{\arraystretch}{1.5}
    \begin{tabular}{@{}l*{2}{C{#4}}}
    \hline 
    Particle & Voltage & Flow rate \\ 
    \hline 
    #1&\SI{#2}{\volt}&\SI{#3}{\micro\liter\per\minute}  \\ 
    \hline 
    \end{tabular}
\end{center}
}

\begin{document}        
\exptable{Stuff}{4.5}{1.2345}{3cm}
\end{document}

관련 정보