
tabularray
es bastante útil ya que necesito hacer estas cosas:
- Mantenga la mesa tan ancha como
\textwidth
- Necesito insertar
note{}
en el título de la tabla. - El encabezado de la tabla son dos muchos caracteres, por lo que están divididos en varias líneas en una celda. En este caso, necesito mantener las cabezas cortas para que estén en el centro de la celda de la mesa.
- Mantenga el número decimal alineado
Que yo sé:
- Para lograrlo
1
, puedo usartblr
otalltblr
conX
formato. - Para lograrlo
2
, necesito usartalltblr
- Para lograrlo
4
, puedo usartalltblr
withX
ysi={}
Pero, ¿cómo puedo 3
lograrlo talltblr
? Si podemos fusionar Q
el formato talltblr
, estas cuatro funciones podrían lograrse al mismo tiempo.
Por ejemplo:
\documentclass{article}
\usepackage{tabularray}
\usepackage{siunitx}
\usepackage{romannum}
\UseTblrLibrary{booktabs, siunitx}
\begin{document}
\begin{table}[h]
\begin{talltblr}
[caption={Main component geographic information table\TblrNote{1}},
label={tab:Main component geographic information table},
note{1}={The data is obtained through satellite maps, and there are certain errors},
note{2}={The latitude and longitude of the surface is the latitude and longitude of its centroid. There is a certain error in the measurement of latitude and longitude, for reference},
note{3}={This length is the length in our study area}
]
{colspec={
X[1.5,r] X[1.3,c] X[1.3,c] X[c,si={table-format=4.2},0.8] X[c,si={table-format=4.2},0.8] X[c,si={table-format=1.2},0.8]
}
}
\toprule
name & latitude\TblrNote{2} & longitude &{gggggg\unit{\m}} & gggggg\unit{\m} \TblrNote{3} &{{{area total\unit{\km\squared}}}}\\
\midrule
DongLake &\ang{30;33;29.52}N &\ang{114;22;47.55}E & & & 12.74 \\
dongtinglake &\ang{30;33;12.71}N &\ang{114;20;46.87}E & & &0.12 \\
great river &\ang{30;33;33.66}N &\ang[minimum-integer-digits=2]{114;20;09.29}E & 1682.88& & \\
bigbig lake &\ang[minimum-integer-digits=2]{30;34;06.02}N &\ang{114;19;45.86}E & & & 2.74 \\
inside the gate &\ang{30;33;54.85}N &\ang{114;18;35.99}E & & & 0.06 \\
new ditches &\ang{30;35;33.19}N &\ang[minimum-integer-digits=2]{114;23;02.77}E & 977 & & \\
west part of new gate &\ang{30;35;26.31}N &\ang{114;21;43.67}E & 5213.77 & & \\
luoai port &\ang[minimum-integer-digits=2]{30;37;08.49}N &\ang{114;21;27.93}E & 3770.58 & & \\
qingling port &\ang[minimum-integer-digits=2]{30;39;02.32}N &\ang{114;24;30.27}E & & & 0.13 \\
from port to lake &\ang[minimum-integer-digits=2]{30;37;03.06}N &\ang{114;24;22.99}E & 345.15 & & \\
east part of the gate &\ang[minimum-integer-digits=2]{30;38;05.41}N &\ang{114;24;27.64}E &2926.08 & & \\
Yangzi river &\ang{30;37;43.29}N &\ang{114;20;58.87}E & & & \\
east part of the lake &\ang{30;35;55.14}N &\ang{114;23;14.49}E & 1090.45 & & \\
donghu port &\ang{30;35;37.38}N &\ang{114;23;45.81}E & 7332.3 & \num{4614.19} & \\
west section of qingqing &\ang[minimum-integer-digits=2]{30;38;01.20}N &\ang{114;24;11.10}E & 3449.86 & & \\
new road drainage station &\ang{30;33;55.17}N &\ang{114;18;48.14}E & & & \\
nanjing drainage station &\ang{30;33;52.23}N &\ang{114;18;29.72}E & & & \\
beijing pumping station &\ang{30;37;22.34}N &\ang[minimum-integer-digits=2]{114;21;01.01}E & & & \\
guilin road gata &\ang{30;37;19.42}N &\ang{114;20;57.23}E & & & \\
the last gate &\ang{30;39;16.08}N &\ang{114;24;31.97}E & & & \\
\bottomrule
\end{talltblr}
\end{table}
\end{document}
¿Cómo hacer esta tabla para lograr las cuatro solicitudes?
Otra pregunta: ¿por qué no puedo reemplazar gggggg
con Length
? Cuando hice esto, hay un error:Package siunitx Error: Invalid number 'e'.
Respuesta1
Editar: Ups, no subí la última versión del código y la imagen. Corregido ahora. Lo siento por el ruido...
Como punto de partida:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx} % libraries loads packages of the same names
\begin{document}
\begin{table}[h]
\sisetup{minimum-integer-digits=2}
\begin{talltblr}[
caption = {Main component geographic information table},
label = {tab:Main component geographic information table},
remark{Note} = {The data are obtained through satellite maps, and there are certain errors},
note{1} = {The latitude and longitude of the surface is the latitude and longitude of its centroid. There is a certain error in the measurement of latitude and longitude, for reference},
note{2} = {This length is the length in our study area},
note{3} = {Total area}
]{colsep = 3pt,
colspec = {@{} X[2,l, m, font=\linespread{0.84}\selectfont] r r
*{2}{X[c, si={table-format=4.2}]}
X[c, si={table-format=2.2,
minimum-integer-digits=1}]
@{}},
row{1} = {font=\small\bfseries, c, m}
}
\toprule
name & latitude\TblrNote{1}
& longitude
& {{{gggggg \unit{\metre}}}}
& {{{gggggg\TblrNote{2} \unit{\metre}}}}
& {{{area\TblrNote{3} \unit{\km\squared}}}}\\
\midrule
Dong Lake & \ang{30;33;29.52}N
& \ang{114;22;47.55}E
& & & 12.74 \\
Dongting Lake
& \ang{30;33;12.71}N
&\ang{114;20;46.87}E
& & & 0.12 \\
Great river & \ang{30;33;33.66}N
& \ang{114;20;09.29}E
& 1682.88
& & \\
Big lake & \ang{30;34;06.02}N
& \ang{114;19;45.86}E
& & & 2.74 \\
inside the gate
& \ang{30;33;54.85}N
& \ang{114;18;35.99}E
& & & 2.74 \\
new ditches & \ang{30;35;33.19}N
&\ang{114;23;02.77}E
& 977
& & \\
west part of new gate
& \ang{30;35;26.31}N
& \ang{114;21;43.67}E
& 5213.77
& & \\
Luoai port & \ang{30;37;08.49}N
&\ang{114;21;27.93}E
& 3770.58
& & \\
qingling port
& \ang{30;39;02.32}N
&\ang{114;24;30.27}E
& & & 0.13 \\
from port to lake
& \ang{30;37;03.06}N
& \ang{114;24;22.99}E
& 345.15
& & \\
east part of the gate
& \ang{30;38;05.41}N
& \ang{114;24;27.64}E
& 2926.08
& & \\
Yangzi river
& \ang{30;37;43.29}N
& \ang{114;20;58.87}E
& & & \\
east part of the lake
& \ang{30;35;55.14}N
& \ang{114;23;14.49}E
& 1090.45
& & \\
Donghu port & \ang{30;35;37.38}N
& \ang{114;23;45.81}E
& 7332.3
& 4614.19
& \\
west section of qingqing
& \ang{30;38;01.20}N
& \ang{114;24;11.10}E
& 3449.86
& & \\
new road drainage station
& \ang{30;33;55.17}N
&\ang{114;18;48.14}E
& & & \\
nanjing drainage station
& \ang{30;33;52.23}N
& \ang{114;18;29.72}E
& & & \\
Beijing pumping station
& \ang{30;37;22.34}N
&\ang{114;21;01.01}E
& & & \\
Guilin road gata
& \ang{30;37;19.42}N
&\ang{114;20;57.23}E
& & & \\
the last gate
& \ang{30;39;16.08}N
& \ang{114;24;31.97}E
& & & \\
\bottomrule
\end{talltblr}
\end{table}
\end{document}
Notas:
Realmente lees (una y otra vez) la documentación del paquete. No solo leer, sino también experimentar con diferentes configuraciones para el formato de columnas. Mis experiencias me muestran que el mejor método de aprendizaje esaprender haciendo. Al principio lleva un poco de tiempo, pero pronto descubrirás la filosofía de tabularray
la sintaxis.
- El significado de las opciones
c
(centro),l
(izquierda),r
(derecha) ym
(centro),t
(arriba)b
(abajo, las tres últimas están definidas en elarray
paquete) es el mismo que en las mesas clásicas. - Además de las opciones mencionadas,tabularray
introduzca tres opciones más:h
(cabeza, en la parte superior de la celda),f
(pie, en la parte inferior de la celda) yj
(justificado). - Estas opciones se pueden utilizar de forma independiente o como atributos de
X
tiposQ
de columnas. Por ejemplo:X[c]
tiene ancho, que es calculado por LaTeX y el contenido de la columna es horizontal- `X[2,l] tiene el doble de ancho, lo cual se calcula mediante LaTeX y el contenido de la columna alineado a la izquierda
Q[c, 2cm]
oQ[c, wd=2cm]
definir una columna con 2 cm de ancho y contenido centrado horizontalmenteX[j]
tiene texto justificado, que se divide con guiones cuando es necesario- la columna
c
se comporta igual que en las tablas "clásicas" el ancho de la columna es igual al ancho del contenido más largo en las celdas y está centrado horizontalmente (lo mismo ocurre con otras opciones)
- En
S
las columnas (definidas comoS
columna o, por ejemploQ[c, si]
, donde el formato se puede definir\sisetup
fuera de la tabla, consultesiunitx
la documentación), el contenido sin número de dicha celda tenía que corresponder alsiunitx
paquete en las tablas clásicas encerradas entre llaves:- por esto se interrumpe
table-format
la configuración, - Deshabilite la interpretación incorrecta del significado del contenido (tenga en cuenta que
siunitx
se usan algunas letras para designar números, por ejemplo, ¡10e5
significa10 x 10^5
!
- por esto se interrumpe
- Debido al
tabularray
procesamiento diferente de la tabla (usandol3exp
) es necesario agregar dos pares de llaves más (esesiunitx
requisito funciona en todas las circunstancias). - El
tabularray
paquete permite formatear filas. Por ejemplo:- con
row{1} = {font=\bfseries}
texto en negrita prescrito en todas las celdas de la primera fila, - con
row{Z} = {font=\scfaily, c}
fuente prescrita en versalitas y centrado del contenido en la última fila de la tabla
- con
- etc.,
Apéndice: Es posible que le guste el formato de tabla, que agrupa filas, por ejemplo con tres, e inserta un espacio vertical adicional entre ellas. Para esto agregar al preámbulo
\ExplSyntaxOn
\NewChildSelector{eachthree}
{
\int_step_inline:nnnn {5}{3}{\l_tblr_childs_total_tl}
{ \clist_put_right:Nn \l_tblr_childs_clist {##1} }
}
\ExplSyntaxOff
y al preámbulo de la presentación:
row{eachthree} = {abovesep=2ex},
Considerando estas adiciones, la tabla quedará de la siguiente manera: