%EB%A5%BC%20%ED%91%9C%20%ED%98%95%EC%8B%9D%20%EC%97%B4%EB%A1%9C%20%EB%A6%AC%EB%94%94%EB%A0%89%EC%85%98%ED%95%A0%20%EC%88%98%20%EC%9E%88%EB%82%98%EC%9A%94%3F.png)
이 질문은 내 질문에 대한 후속 조치입니다.이전 질문:
셀 내용의 양쪽에 여는 중괄호와 닫는 중괄호를 사용 >
하고 연결하는 것이 가능합니까 ? <
좀 더 구체적으로 말하면 다음 열을 정의하고 싶습니다.
\newcolumntype{P}{>{\leavevmode\kern-\tabcolsep\bfseries\parbox[t]{\hsize}{}X<{}}}
.\parbox
나는 짧은 MNWE를 동봉합니다:
\documentclass[table]{article}
\usepackage{lmodern, microtype, xcolor, tabularx, tabulary}
\begin{document}
\begin{tabularx}{0.5\columnwidth}{>{\raggedright\arraybackslash\leavevmode\kern-\tabcolsep\parbox[t]{\hsize}{ }X<{}}XX<{\leavevmode\kern-\tabcolsep\raggedleft\arraybackslash}}
\rowcolor{lightgray}All this testing is not so funny&test&test\\\hline
testing, testing and even more testing &test&test\\
\rowcolor{lightgray}I want to write a noce table in a simple way&test&test\\
\end{tabularx}
\end{document}
답변1
버팀대를 덮는 >{}
것은 <{}
예상보다 어려워 보입니다. 명시적인 중괄호 토큰을 사용하는 방법을 생각해낼 수 없습니다. 다음은 TeX의 구분된 인수를 사용하는 대체 솔루션입니다. 직접 사용하는 대신 이를 래핑하는 \parbox
도우미 매크로를 정의합니다 \parboxx ... \endparboxx
. 그런 다음 이 매크로는 새 열 유형에서 사용됩니다 P
.
\documentclass[table]{article}
\usepackage{lmodern, microtype, xcolor, tabularx, tabulary}
\begin{document}
\def\parboxx#1\endparboxx{\parbox[t]{\hsize}{\raggedright#1}}
\newcolumntype{P}{>{\leavevmode\kern-\tabcolsep\bfseries\parboxx}X<{\endparboxx}}
\begin{tabularx}{0.5\columnwidth}{PXX<{\leavevmode\kern-\tabcolsep\raggedleft\arraybackslash}}
\rowcolor{lightgray}All this testing is not so funny&test&test\\\hline
testing, testing and even more testing &test&test\\
\rowcolor{lightgray}I want to write a noce table in a simple way&test&test\\
\end{tabularx}
\end{document}
출력