tabularray rowspec을 사용하면 Q[f]는 셀을 맨 아래에 정렬하지 않습니다. 캡션을 제거하는 방법은 무엇입니까?

tabularray rowspec을 사용하면 Q[f]는 셀을 맨 아래에 정렬하지 않습니다. 캡션을 제거하는 방법은 무엇입니까?

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

이것은 내 코드입니다.

latex
% **************************************************
% Document Class
% **************************************************
\documentclass[
    paper=A4,                   %
    11pt,                       % font size
]{scrreprt}    

\usepackage{tabularray}
\usepackage[svgnames]{xcolor}
\usepackage{amssymb}

\begin{document}

\NewTblrEnviron{mytblr} % define a new environment
\SetTblrOuter[mytblr]{long}
\SetTblrInner[mytblr]{  % set the default styles
colspec = {|
X[4.0cm,l]|
X[0.7cm,r]|
X[l]|
X[0.7cm,r]|
X[1.2cm,r]|
X[1.0cm,l]|},
width = 1.00\linewidth,
column{2,3,6} = {mode=dmath},
column{5} = {fg=blue},
rowspec={|
Q[h]|
Q[h]|
Q[m]|
Q[f]|
Q[f]|
Q[f]|}
}

\def\s{454}
\def\k{0.00394}
\def\treq{1.7886}

\begin{mytblr}[
  caption = {},
]{
  % more specs
}   
Factor
        & t_{req}
        & {= k \times  s \\ = \k \times  \s \\ = \treq}
        & t_{req}
        & 1.78876
        & \mathrm{mm} \\ 
\end{mytblr}

\end{document}

답변1

tabularray템플릿에 의존하므로 기본 템플릿을 변경하거나 새 템플릿을 선언 및 설정한 다음 테이블과 "바인딩"해야 합니다. 데모를 위해 이라는 템플릿을 만들었습니다 nocaptemplate. 이는 사용자 정의 테마에 적용되고 mytheme, 이는 다시 에 적용됩니다 mytblr.

하단 정렬은 여러 가지 방법으로 수행할 수 있지만 f마지막 세 개의 열 정의에 추가하는 것이 나에게 효과적이었습니다.

코드에 오류가 있습니다. 예를 들어 4번째 열에 수학 모드를 설정하지 않고 수학 표현식을 사용했습니다 \t_{...}. 여러 줄의 내용에 대해서는 \\수학 환경 내에서 사용하려고 했습니다 . 각 줄마다 인라인 수학 모드를 사용해야 하며 해당 열에 대한 수학 모드를 끄거나 다중 행 환경을 사용해야 합니다. 예: aligned; 이것이 아마도 가장 편리한 접근 방식일 것입니다.

기존 매크로를 재정의하려고 할 때 경고하는 \newcommand대신 새 매크로를 만드는 데 사용합니다 .\def...

테이블이 여러 페이지에 걸쳐 있어야 하는 경우 여러 페이지에 걸쳐 있을 때 첫 번째 행 과 마지막 행을 복사하는 rowhead = m및/또는 추가를 고려하세요 .rowfoot = nmn

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

% **************************************************
% Document Class
% **************************************************
\documentclass[
paper=A4,                   %
11pt,                       % font size
]{scrreprt}    

\usepackage[svgnames]{xcolor}
\usepackage{tabularray}
\usepackage{amsmath,amssymb}

% Removes captions
\DeclareTblrTemplate{caption}{nocaptemplate}{}
\DeclareTblrTemplate{capcont}{nocaptemplate}{}
\NewTblrTheme{mytabletheme}{
  \SetTblrTemplate{caption}{nocaptemplate}{}
  \SetTblrTemplate{capcont}{nocaptemplate}{}
}
\NewTblrEnviron{mytblr} % define a new environment
\SetTblrOuter[mytblr]{
  theme=mytabletheme,
  long,
}
\SetTblrInner[mytblr]{  % set the default styles
  width = \linewidth,
  colspec = {            
    X[5,l]             %<--- X only makes sense when using with proportions
    X[1,r]             %<--- Otherwise, behaves as a regular Q[...]
    X[5,l]
    X[1,r,f]
    X[2,r,f]
    X[2,l,f]
  },
  column{2-6} = {mode=dmath},
  column{5} = {fg=blue},
  hlines, vlines,
  % row{1,Z} = {font=\bfseries},  %<--- the first and the last row in bold 
  % rowhead = 1, rowfoot = 1,     %<--- would copy the first/last column on subsequent pages
}


\begin{document}
\newcommand\vars{454}
\newcommand\vark{0.00394}
\newcommand\treq{1.7886}

\begin{mytblr}{}   
  Factor
  & t_{req}
  & \begin{aligned}[t]&= k \times s\\&= \vark \times \vars\\&= \treq\end{aligned}
  & t_{req}
  & 1.7887
  & \mathrm{mm} \\
\end{mytblr}
\end{document}

답변2

  • MWE에 오류가 있습니다. table33을 사용할 때는 rowhead = {1}최소한 두 개의 행이 있어야 합니다!
  • 테이블이 정말 긴 테이블인가요? 그렇지 않은 경우 tblr테이블 환경을 고수하는 것이 더 간단합니다.
  • 나는 테이블의 두 번째와 세 번째 열이 실제로 셀에 aligned수학이 있는 하나의 열이라고 생각합니다. 하지만 다른 테이블 행의 ID에 대한 정보를 제공하지 않았기 때문에 확실하지 않습니다.

다음 해결 방법이 효과가 있는지 확인하세요.

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{amsmath}
\DeclareMathOperator{\req}{req}

\begin{document}

\begingroup
\DefTblrTemplate{firsthead, middlehead,lasthead}{default}{} % <---

\def\s{454}
\def\k{0.00394}
\def\treq{1.7886}

\begin{longtblr}{
        rowhead = {1},
        colspec = {X[0.8, l] X[1.2, c] 
                   Q[f] Q[c, f, fg=blue] Q[f]},
        column{2,3} = {mode=dmath},
        row{1} = {font=\bfseries, mode=text},
        hline{1,2,Z} =1pt, hline{3-Y}=solid, vlines
                }
        & A & B & C & D         \\
Factor  & \begin{aligned}[t]
            t_{\req}    & = k \times    s \\ 
                        & = \k \times  \s \\ 
                        & = \treq
          \end{aligned}
            & t_{\req}
                & 1.78876
                    & mm    \\
text  & p_{\req} = 2\cdot\treq
            & p_{\req}
                & 3.57752
                    & mm    \\
\end{longtblr}
\endgroup

\end{document}

편집하다:
이제 위의 MWE로 제작된 이미지가 삽입됩니다!

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

관련 정보