`tabularray`에서 `X`와 `Q` 스타일을 동시에 유지하는 방법은 무엇입니까?

`tabularray`에서 `X`와 `Q` 스타일을 동시에 유지하는 방법은 무엇입니까?

tabularray다음 작업을 수행해야 하므로 매우 유용합니다.

  1. 테이블을 최대한 넓게 유지하세요.\textwidth
  2. note{}표의 캡션에 삽입해야 합니다.
  3. 테이블의 머리 부분은 두 개의 문자이므로 한 셀에 여러 줄로 나누어져 있습니다. 이 경우 테이블의 셀 중앙에 짧은 머리를 유지해야 합니다.
  4. 소수점 이하 숫자를 정렬하세요.

내가 아는 대로:

  • 을 달성하려면 or 형식 을 1사용할 수 있습니다 .tblrtalltblrX
  • 달성하려면 2다음을 사용해야 합니다.talltblr
  • 을 달성하려면 다음과 함께 4사용할 수 있습니다 .talltblrXsi={}

하지만 어떻게 달성할 수 3있나요 talltblr? Q형식을 로 병합할 수 있다면 talltblr이 네 가지 기능을 동시에 달성할 수 있습니다.

예를 들어:

\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}

네 가지 요청을 달성하기 위해 이 테이블을 만드는 방법은 무엇입니까? 여기에 이미지 설명을 입력하세요

gggggg또 다른 질문: 왜 로 바꿀 수 없나요 Length? 이 작업을 수행하면 오류가 발생합니다.Package siunitx Error: Invalid number 'e'.

답변1

편집하다: 죄송합니다. 마지막 버전의 코드와 이미지를 업로드하지 않았습니다. 지금은 수정되었습니다. 소음에 대한 So4ry ...

출발점:

\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}

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

노트: 당신은 실제로 패키지 문서를 (반복해서) 읽었습니다. 읽기만 하는 것이 아니라 열 형식 지정에 대한 다양한 설정을 실험해 봅니다. 내 경험에 따르면 가장 좋은 학습 방법은 다음과 같습니다.실천하면서 배우는 것. 처음에는 약간의 시간이 소요되지만 곧 tabularray구문 철학을 이해하게 될 것입니다.

  • c옵션 (center), l(left), r(right) 및 m(middle), t(top) b(하단, 마지막 3개는 패키지에 정의되어 있음 ) 의 의미는 array클래식 테이블과 동일합니다. - 언급된 옵션 외에도 (머리, 셀 상단), (발, 셀 하단) 및 (정렬)의 tabularray세 가지 옵션을 더 소개합니다 .hfj
  • 이 옵션은 독립형으로 사용하거나 열 유형의 속성으로 사용할 수 X있습니다 Q. 예를 들어:
    • X[c] 너비는 LaTeX로 계산되며 열 내용은 가로입니다.
    • `X[2,l]의 너비는 LaTeX와 왼쪽 정렬된 열 내용으로 계산됩니다.
    • Q[c, 2cm]또는 Q[c, wd=2cm]너비가 2cm이고 내용이 가로 중심에 있는 열을 정의합니다.
    • X[j]필요할 때 하이픈으로 연결되는 텍스트를 정렬했습니다.
    • 열은 c"클래식" 테이블과 동일하게 동작합니다. 열의 너비는 셀에서 가장 긴 내용의 너비와 동일하며 가로 중심에 위치합니다(다른 옵션에서도 마찬가지입니다).
  • S열(열로 정의하거나 S예를 들어 형식을 테이블 외부 Q[c, si]에서 정의할 수 있는 경우 설명서 참조) 에서 해당 셀의 숫자 없는 내용은 중괄호 쌍으로 묶인 클래식 테이블의 패키지를 따라야 했습니다 .\sisetupsiunitxsiunitx
    • 이로 인해 table-format설정이 중단되었습니다.
    • siunitx콘텐츠 의미의 잘못된 해석을 비활성화했습니다( 지정 숫자에 일부 문자를 사용한다는 점을 명심하세요. 예 10e5를 들어 10 x 10^5, !
  • tabularray다른 테이블 처리로 인해( 사용 ) l3exp중괄호 쌍을 두 개 더 추가해야 합니다(해당 siunitx요구 사항은 모든 상황에서 작동함).
  • 패키지 tabularray를 사용하면 행 서식을 지정할 수 있습니다. 예를 들어:
    • row{1} = {font=\bfseries}첫 번째 행의 모든 ​​행 셀에 굵은 글씨 텍스트를 규정하고 ,
    • 작은 대문자 글꼴을 규정 하고 row{Z} = {font=\scfaily, c}표의 마지막 행에 내용의 중심을 지정합니다.
  • 등.,

부록: 예를 들어 행을 세 개로 그룹화하고 행 사이에 추가 수직 공간을 삽입하는 테이블 서식을 좋아할 것입니다. 이를 위해 서문에 추가

  \ExplSyntaxOn
\NewChildSelector{eachthree}
  {
    \int_step_inline:nnnn {5}{3}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff

그리고 테이블 서문에:

                   row{eachthree} = {abovesep=2ex},

이 추가 사항을 고려하면 테이블은 다음과 같이 손실됩니다.

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

관련 정보