여러 줄 셀로 테이블을 코딩하는 방법
LaTeX로 짧은 논문을 작성하려고하는데 3 개의 열이있는 표를 추가해야합니다.
+-------------+-----------------+--------------------------------------+
| AAAAAAAAAA | BBBBBBBBBBBBBBB | Betty Botter Bought a Bit of Butter |
| | | but the Butter's Bitter |
+-------------+-----------------+--------------------------------------+
| CCCCCCCC | DDDD | Betty Botter Thought: |
| | | If I Put This Bitter Butter in My |
| | | Batter it Will Make My Batter Bitter |
+-------------+-----------------+--------------------------------------+
불행히도 나는 그것을 할 올바른 관용구를 찾지 못하는 것 같습니다.
나는 시도했다 :
\begin{tabular}{lll}
AAAAAAAAAA & BBBBBBBBBBBBBBB & Betty Botter Bought a Bit of Butter but
the Butter's Bitter \\
CCCCCCCC & DDDD & Betty Botter Thought: \newline If I Put This Bitter Butter in My Batter it Will Make My Batter Bitter
\end{tabular}
그러나 LaTeX는 셀 내에서 줄 바꿈이나 서식을 지정하지 않습니다. 그렇게하려면 말해야 할 것 같은데 ..하지만 어떻게?
p
열 설명자를 사용하십시오 .
변화
\begin{tabular}{lll}
...에
\begin{tabular}{llp{5cm}}
줄 바꿈을 명시 적으로 삽입하려면 :
CCCCCCCC & DDDD & \parbox{5cm}{Betty Botter Thought: \\ If I Put This Bitter Butter in My Batter it Will Make My Batter Bitter}
이것이 내 필요에 대해 지금까지 찾은 대답입니다. Link here .
보다 적절한 방식으로 테이블 내부에 테이블을 만드는 새로운 명령을 생성합니다.
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}
따라서 다음과 같이 셀 내부에서 강제 줄 바꿈을 수행하려면 다음을 수행하십시오.
\begin{tabular}{|c|c|c|}
\hline
Foo bar & Foo <forced line break here> bar & Foo bar \\
\hline
\end{tabular}
다음과 같은 코드를 사용하게됩니다.
Foo bar & \specialcell{Foo\\bar} & Foo bar \\ % vertically centered
Foo bar & \specialcell[t]{Foo\\bar} & Foo bar \\ % aligned with top rule
Foo bar & \specialcell[b]{Foo\\bar} & Foo bar \\ % aligned with bottom rule
c @ 를 l @ 또는 r @ 로 변경하여 새 명령 선언에서 수평 정렬을 제어 할 수 있습니다.
모든 크레딧은 Tex 포럼의 egreg 에게 전달 됩니다.
@aioobe가 답변에서 썼 듯이이 경우 왼쪽 정렬에서 전환 할 수 있습니다.
\begin{tabular}{lll}
받는 단락 정렬 번째 열에 적어도 맞춤 LINEBREAK 수동 삽입해야 여기서
\begin{tabular}{llp{.5\textwidth}}
이 편집 후에는 명령 \par
(대신 \newline
)을 사용하여 셀 내에서 줄 바꿈을 구현할 수 있습니다 .
이 코드 :
\documentclass{article}
\begin{document}
\begin{tabular}{llp{.5\textwidth}}
AAAAAAAAAA & BBBBBBBBBBBBBBB & Betty Botter Bought a Bit of Butter \par but the Butter's Bitter\\
CCCCCCCC & DDDD & Betty Botter Thought: \par If I Put This Bitter Butter in My \par Batter it Will Make My Batter Bitter\\
\end{tabular}
\end{document}
요청 된 출력을 생성합니다.
여기에 멋진 코딩이없는 답변이 있습니다. 행을 별도의 줄에 작성하십시오. 마지막 행을 제외한 모든 행 (행)에 대해 \ hline을 생략하십시오. 빠르고 지저분하지만 어쨌든 작동하고 어쨌든 간단한 테이블에 대해 내가 원하는 것을 정확하게 제공합니다. 나는 자동차 앞 유리에 광고를하고 있었다. 각 셀에 3 개의 중앙 행이 있습니다.
iTutor Grahamstown
Mathematics Tutor
0793296211
I wanted this repetitively in my table. I just left out the \hline for the first two rows. The multiple \hlines and '|' are to make cutting up the printout easier.
\begin{tabular}{||c||c||c||c||}
\hline\hline
iTutor Grahamstown &iTutor Grahamstown&iTutor Grahamstown &iTutor Grahamstown \\ %No \hline
Mathematics Tutor & Mathematics Tutor & Mathematics Tutor&Mathematics Tutor \\ %No \hline
0793296211 & 0793296211 & 0793296211 & 0793296211\\ \hline\hline\hline %\hline now
\end{tabular}
I hope that this helps.
ReferenceURL : https://stackoverflow.com/questions/2895780/how-to-code-tables-with-multi-line-cells
'developer tip' 카테고리의 다른 글
Apache에서 POST 데이터를 기록하는 가장 좋은 방법은 무엇입니까? (0) | 2021.01.08 |
---|---|
웹 개발에 대한 기본적이지만 중요한 질문이 있습니까? (0) | 2021.01.08 |
전체 분기가 아닌 git 부분 병합 (0) | 2021.01.08 |
JavaScript로 옵션 텍스트 / 값 얻기 (0) | 2021.01.08 |
작업 복사본을 수정하지 않고 Git 브랜치를 리베이스 할 수 있습니까? (0) | 2021.01.08 |