특정 수학 기호에 테이블 열 정렬

특정 수학 기호에 테이블 열 정렬

나는 가지고있다longtabu원래는 \newglossarystylein 의 일부였습니다.glossaries기호 목록이지만 MWE용으로 추출했습니다. 첫 번째 열에는 수학 연산자가 표시되고 두 번째 열에는 해당 설명이 표시됩니다. 보시다시피 첫 번째 열은 다소 지저분해 보입니다. 첫 번째 열을 대괄호 중앙에 두는 것이 훨씬 더 좋을 것입니다. 자동으로 달성할 가능성이 있나요?

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

나는 이미 대괄호 앞뒤에 s를 가지고 놀려고 시도했지만 \hphantom이로 인해 많은 수작업이 필요하고 전역적으로 유효하지 않습니다. 열을 소수점으로 정렬하려면 또는다른 기호거기에dcolumn패키지를 받았지만 원하는 결과를 얻을 수 없었습니다. 마지막으로 시도한 것은 단순히 정의 \begin{longtabu} to \linewidth {r@{${}\left(\phantom{a}\right){}$}lX}에 배치 longtabu하고 multicolumn대괄호를 원하지 않는 곳 어디든 사용하는 것입니다. 그러나 정렬도 잘못되었습니다.

대괄호의 첫 번째 열을 정렬하는 자동화된 방법이 있습니까?


원본 MWE

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\newcommand*\dif{\mathop{}\!\mathrm{d}}

\begin{document}

\begingroup
\renewcommand{\arraystretch}{1.4}
\begin{longtabu} to \linewidth {cX}
Symbol                                      & Description   \tabularnewline
$\bar{\left(\phantom{a}\right)}$            & Operator 1    \tabularnewline
$\dif\left(\phantom{a}\right)$              & Operator 2    \tabularnewline
$\dot{\left(\phantom{a}\right)}$            & Operator 3    \tabularnewline
$\left(\phantom{a}\right)_{,x}$             & Operator 4    \tabularnewline
$\hat{\left(\phantom{a}\right)}$            & Operator 5    \tabularnewline
$\left(\phantom{a}\right)^{-1}$             & Operator 6    \tabularnewline
$\partial\left(\phantom{a}\right)$          & Operator 7    \tabularnewline
$\left(\phantom{a}\right)^T$                & Operator 8    \tabularnewline
\end{longtabu}
\endgroup

\end{document}

시도 1

여러 열의 중앙 방향으로 인해 이러한 선이 엉망이 됩니다.

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\newcommand*\dif{\mathop{}\!\mathrm{d}}

\begin{document}

\begingroup
\renewcommand{\arraystretch}{1.4}
\begin{longtabu} to \linewidth {r@{${}\left(\phantom{a}\right){}$}lX}
\multicolumn{2}{c}{Symbol}                           & Description   \tabularnewline
\multicolumn{2}{c}{$\bar{\left(\phantom{a}\right)}$} & Operator 1    \tabularnewline
$\dif$                                              && Operator 2    \tabularnewline
\multicolumn{2}{c}{$\dot{\left(\phantom{a}\right)}$} & Operator 3    \tabularnewline
&$_{,x}$                                             & Operator 4    \tabularnewline
\multicolumn{2}{c}{$\hat{\left(\phantom{a}\right)}$} & Operator 5    \tabularnewline
&$^{-1}$                                             & Operator 6    \tabularnewline
$\partial$                                          && Operator 7    \tabularnewline
&$^T$                                                & Operator 8    \tabularnewline
\end{longtabu}
\endgroup

\end{document}

시도 2

\newglossaryentry기본적으로는 괜찮지만 정의 에서 이것을 사용하는 맥락에서는 적용할 수 없습니다 glossaries.

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\newcommand*\dif{\mathop{}\!\mathrm{d}}

\begin{document}

\begingroup
\renewcommand{\arraystretch}{1.4}
\begin{longtabu} to \linewidth {r@{}c@{}lX}
\multicolumn{3}{c}{Symbol}                              & Description   \tabularnewline
           & $\bar{\left(\phantom{a}\right)}$ &         & Operator 1    \tabularnewline
$\dif$     & $\left(\phantom{a}\right)$       &         & Operator 2    \tabularnewline
           & $\dot{\left(\phantom{a}\right)}$ &         & Operator 3    \tabularnewline
           & $\left(\phantom{a}\right)$       & $_{,x}$ & Operator 4    \tabularnewline
           & $\hat{\left(\phantom{a}\right)}$ &         & Operator 5    \tabularnewline
           & $\left(\phantom{a}\right)$       & $^{-1}$ & Operator 6    \tabularnewline
$\partial$ & $\left(\phantom{a}\right)$       &         & Operator 7    \tabularnewline
           & $\left(\phantom{a}\right)$       & $^T$    & Operator 8    \tabularnewline
\end{longtabu}
\endgroup

\end{document}

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

나는 이 체계를 용어집에 적용할 수 있었습니다. 하지만 수작업이 많이 필요한 것 같습니다.

기호 정의:

\newglossary[slg7]{operatorlist}{syi7}{syg7}{Operators}
% compile with: makeindex -s %S.ist -t %S.slg7 -o %S.syi7 %S.syg7

\newglossaryentry{symb:operator:bar}{%
  symbol      ={$\bar{\left(\phantom{a}\right)}$},%
  name        ={},%
  description ={Value in material coordinate system},%
  user1       ={},%
  user2       ={$\protect\bar{\protect\left(\protect\phantom{a}\protect\right)}$},%
  user3       ={},%
  type        =operatorlist,%
  sort        =olocalbar,%
}

\newglossaryentry{symb:operator:dif}{%
  symbol      ={$\dif\left(\phantom{a}\right)$},%
  name        ={},%
  description ={Differential operator},%
  user1       ={$\protect\dif$},%
  user2       ={$\protect\left(\protect\phantom{a}\protect\right)$},%
  user3       ={},%
  type        =operatorlist,%
  sort        =odifdifferential,%
}

\newglossaryentry{symb:operator:dx}{%
  symbol      ={$\left(\phantom{a}\right)_{,x}$},%
  name        ={},%
  description ={Spatial derivative with respect to coordinate $x$},%
  user1       ={},%
  user2       ={$\protect\left(\protect\phantom{a}\protect\right)$},%
  user3       ={$_{,x}$},%
  type        =operatorlist,%
  sort        =odifdx,%
}

glossaries스타일:

\newglossarystyle{myoperatorstyle}{%
  \renewcommand*{\glsclearpage}{}%
  \renewenvironment{theglossary}%
    {%
      \begingroup%
      \renewcommand{\arraystretch}{1.4}%
      \begin{longtabu} to \linewidth {@{\ \;}r@{}c@{}lX}
    }%
    {%
      \end{longtabu}
      \endgroup
    }%
  % Header line
  \renewcommand*{\glossaryheader}{%
    \multicolumn{3}{@{}c}{\textbf{Symbol}} & \textbf{Description}%
    \tabularnewline%
    \tabularnewline%
    \endhead%
    \endfoot%
  }%
  % indicate what to do at the start of each logical group
  \renewcommand*{\glsgroupskip}{\tabularnewline}% What to do between groups
  % entry
  \renewcommand*{\glossentry}[1]{%
    \glsentryitem{##1}% Entry number if required
    \glsentryuseri{##1} &
    \glsentryuserii{##1} &
    \glsentryuseriii{##1} &
    \glossentrydesc{##1}
    \tabularnewline%
  }%
}

인쇄용어집:

\printglossary[type=operatorlist,style=myoperatorstyle,nonumberlist]

답변1

패키지로 하시면 됩니다 eqparbox. 이를 위해 tpsymb나는 쉽게 추측할 수 있듯이 3개의 인수인 '사전 기호', 기본 기호(파일 전체에서 동일해야 함) 및 '후-기호'를 사용하여 명령(세 부분으로 구성된 기호)을 정의합니다. 상징'. 사전 및 사후 파트는 에 배치되어 \eqmakebox각 사전 파트의 너비가 동일하고 사후 파트도 유사합니다.

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}
\usepackage{ eqparbox}

    \newcommand\eqmathbox[2][M]{\eqmakebox[#1][l]{$\displaystyle#2$}}

\newcommand*\dif{\mathop{}\!\mathrm{d}}
\newcommand\tpsymb[3]{\eqmakebox[pre][r]{\ensuremath{#1}}\ensuremath{#2}\eqmakebox[post][l]{\ensuremath{#3}}}

%\newcommand\mysymbol
\begin{document}

\begingroup
\renewcommand{\arraystretch}{1.4}
\noindent
\begin{longtabu} to \linewidth {cX}
Symbol & Description \tabularnewline
\tpsymb{}{\bar{\left(\phantom{a}\right)}}{} & Operator 1 \tabularnewline
\tpsymb{\dif}{\left(\phantom{a}\right)}{} & Operator 2 \tabularnewline
\tpsymb{}{\dot{\left(\phantom{a}\right)}}{} & Operator 3 \tabularnewline
\tpsymb{}{\left(\phantom{a}\right)}{_{,x}} & Operator 4 \tabularnewline
\tpsymb{}{\hat{\left(\phantom{a}\right)}}{} & Operator 5 \tabularnewline
\tpsymb{}{\left(\phantom{a}\right)}{^{-1}} & Operator 6 \tabularnewline
\tpsymb{\partial}{\left(\phantom{a}\right)}{} & Operator 7 \tabularnewline
\tpsymb{}{\left(\phantom{a}\right)}{^T} & Operator 8 \tabularnewline
\end{longtabu}
\endgroup

\end{document} 

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

답변2

이것은 대부분 미학적 문제입니다. 수학 기호가 필드 중앙에 있더라도바라보다중심. 당신이 해야 할 일은 정말로 중앙에 놓기를 원하는 것을 결정한 다음 정렬 지점을 조정하여 중앙에 맞추는 것입니다.

이 경우에는 $(a)$. 이는 가장 넓은 필드의 너비( Symbol)와 너비를 측정하고 왼쪽 열에 $(a)$추가 \hspace*{\fixup}( 를 사용할 수도 있음 )하여 수행되었습니다.\makebox[\fixup][r]{...}

\documentclass{article}

\usepackage{longtable}
\usepackage{tabu}

\newcommand*\dif{\mathop{}\!\mathrm{d}}

\newlength{\fixup}

\begin{document}

\settowidth{\dimen0}{Symbol}%
\settowidth{\dimen1}{$(a)$}%
\setlength{\fixup}{\dimexpr 0.5\dimen0 - 0.5\dimen1}%

\begingroup
\renewcommand{\arraystretch}{1.4}
\begin{longtabu} to \linewidth {r@{}lX}
\multicolumn{2}{c}{Symbol}              & Description   \tabularnewline
\hspace*{\fixup}% force alignment point to center $(a)$
&$\bar{(\phantom{a})}$    & Operator 1    \tabularnewline
$\dif$&$(\phantom{a})$                  & Operator 2    \tabularnewline
&$\dot{(\phantom{a})}$                  & Operator 3    \tabularnewline
&$(\phantom{a})_{,x}$                   & Operator 4    \tabularnewline
&$\hat{(\phantom{a})}$                  & Operator 5    \tabularnewline
&$(\phantom{a})^{-1}$                   & Operator 6    \tabularnewline
$\partial$&$(\phantom{a})$              & Operator 7    \tabularnewline
&$(\phantom{a})^T$                      & Operator 8    \tabularnewline
\end{longtabu}
\endgroup

\end{document}

데모

관련 정보