tengo unlongtabu
que originalmente es parte de un \newglossarystyle
en glossaries
lista de símbolos pero la extraje para el MWE. La primera columna muestra los operadores matemáticos y la segunda su descripción. Como puede ver, la primera columna parece bastante desordenada. Sería mucho mejor tener la primera columna centrada en los corchetes. ¿Existe la posibilidad de lograrlo automáticamente?
Ya intenté jugar con \hphantom
s antes y después de los corchetes, pero esto resulta en mucho trabajo manual y no es válido globalmente. Para alinear columnas en el punto decimal ootros símbolosahí está eldcolumn
paquete, pero no pude obtener el resultado que quería. Lo último que intenté fue simplemente colocar los corchetes \begin{longtabu} to \linewidth {r@{${}\left(\phantom{a}\right){}$}lX}
en la longtabu
definición y usarlos multicolumn
donde no quiera. Pero la alineación también fue incorrecta.
¿Existe una forma automatizada de lograr la alineación de la primera columna sobre los soportes?
MWE originales
\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}
Intento 1
La orientación centrada de las múltiples columnas confunde estas líneas.
\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}
Intento 2
Básicamente está bien, pero no es aplicable en el contexto del uso de esto \newglossaryentry
en una glossaries
definición.
\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}
Logré aplicar este esquema al glosario. Pero parece mucho trabajo manual:
Definición de símbolo:
\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
estilo:
\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%
}%
}
glosario de impresión:
\printglossary[type=operatorlist,style=myoperatorstyle,nonumberlist]
Respuesta1
Puedes hacerlo con el eqparbox
paquete. Para ello, defino un tpsymb
comando (símbolo de tres partes), con, como se puede adivinar fácilmente, 3 argumentos: un 'pre-símbolo', el símbolo principal (que debe ser el mismo en todo el archivo) y un 'post-símbolo'. símbolo'. Las prepartes y postpartes se colocan en un \eqmakebox
, de modo que cada una de las prepartes tenga el mismo ancho, y lo mismo para las postpartes.
\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}
Respuesta2
Esto es principalmente una cuestión de estética. Incluso si los símbolos matemáticos están centrados en el campo, no lo hacen.mirarcentrado. Lo que debes hacer es decidir qué es lo que realmente quieres centrar y luego ajustar el punto de alineación para centrarlo.
En este caso, me centré $(a)$
. Esto se hizo midiendo el ancho del campo más ancho ( Symbol
) y el ancho de la columna de la izquierda $(a)$
y agregando \hspace*{\fixup}
(también puede usar \makebox[\fixup][r]{...}
) a la columna de la izquierda.
\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}