%EC%9D%80%20%ED%85%8C%EC%9D%B4%EB%B8%94(Tabularray)%EC%97%90%EC%84%9C%20%EC%9E%91%EB%8F%99%ED%95%98%EC%A7%80%20%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4.%20%EC%99%9C%3F%20%EA%B3%A0%EC%B9%A0%20%EC%88%98%20%EC%9E%88%EB%82%98%EC%9A%94%3F.png)
빈 점선으로 채우려는 테이블(tabularray)인 다음 문서가 있습니다. \fillwithdottedlines
MWE에서 볼 수 있는 것처럼 명령을 정의했습니다 . 명령은 외부 tblr
환경에서는 완벽하게 작동하지만 내부에서는 작동하지 않습니다. 왜 이런 일이 발생하며 어떻게 해결할 수 있나요? 오류를 확인하려면 테이블 내에서 이 명령이 포함된 줄의 주석 처리를 제거하세요.
\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm},left=15mm,top=20mm]{geometry}
\usepackage{tabularray}
\makeatletter
\newlength\dottedlinefillheight
\setlength\dottedlinefillheight{9mm}
\def\fillwithdottedlines#1 {%
\begingroup
\ifhmode
\par
\fi
\hrule height \z@
\nobreak
\setbox0=\hbox to \hsize{\hskip \@totalleftmargin
\vrule height \dottedlinefillheight depth \z@ width \z@
\dotfill}%
\cleaders \copy0 \vskip #1 \hbox{}%
\endgroup
}
\makeatother
\begin{document}
\begin{tblr}{colspec={Q[0.5\linewidth-5pt,c]X[c]},row{1,2}={1cm,m},row{3}={15cm,m},vlines,hlines}
\SetCell[c=2]{c} \large \textbf{TITLE} \\
\textbf{Subtitle 1} & \textbf{Subtitle 2} \\
& \\
%\fillwithdottedlines{10cm} & \fillwithdottedlines{10cm} \\
\end{tblr}
\fillwithdottedlines{5cm}
\end{document}
답변1
여기서 실제로 무엇이 잘못되고 있는지 완전히 확신할 수는 없지만(따라서 이것은 단지 부분적인 대답일 뿐입니다) 문제 중 적어도 하나는 \fillwithdottedlines
인수 뒤에 공백이 있어야 하는 정의에서 비롯됩니다(공백이 인수를 구분하기 때문에). . 왼쪽 열의 셀 중 하나에 글을 써서 이를 확인할 수 있습니다 \fillwithdottedlines{5cm} {}
. 그러면 최소한 오류는 발생하지 않지만 여전히 수직 정렬과 관련하여 최적이 아닌 출력이 나타납니다. 어떤 이유로 설명할 수는 없지만 아마도 tblr
구성 방식 때문에 이 트릭이 오른쪽 열의 셀에는 작동하지 않습니다.
그러나 해결책은 예를 들어 를 사용하여 \fillwithdottedlines
매크로를 로 래핑하는 것입니다 . 마지막 닫는 중괄호 앞에 필요한 공간을 조심하세요!\parbox
\parbox{\linewidth}{\fillwithdottedlines{2cm} }
\documentclass[12pt]{article}
\usepackage[a4paper, total={180mm,257mm}, left=15mm, top=20mm]{geometry}
\usepackage{tabularray}
\makeatletter
\newlength\dottedlinefillheight
\setlength\dottedlinefillheight{9mm}
\def\fillwithdottedlines#1 {%
\begingroup
\ifhmode
\par
\fi
\hrule height \z@
\nobreak
\setbox0=\hbox to \hsize{\hskip \@totalleftmargin
\vrule height \dottedlinefillheight depth \z@ width \z@
\dotfill}%
\cleaders \copy0 \vskip #1 \hbox{}%
\endgroup
}
\makeatother
\begin{document}
\begin{tblr}{
colspec = { Q[0.5\linewidth-5pt, c] X[c] },
row{1,2} = {1cm, m},
row{3} = {15cm, m},
vlines,
hlines,
}
\SetCell[c=2]{c} \large \textbf{TITLE} \\
\textbf{Subtitle 1} & \textbf{Subtitle 2} \\
& \\
\parbox{\linewidth}{\fillwithdottedlines{2cm} } &
\parbox{\linewidth}{\fillwithdottedlines{2cm} } \\
\end{tblr}
%\fillwithdottedlines{5cm}
\end{document}