테이블 형식 테이블 만들기

테이블 형식 테이블 만들기

이런 테이블 형식의 테이블을 개발하고 싶습니다. 여기에 이미지 설명을 입력하세요

그러나 참조 코드를 사용하면https://www.overleaf.com/learn/latex/Tables#Creating_a_simple_table_in_LaTeX, 코드 포함:

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{0.8\textwidth} { 
  | >{\raggedright\arraybackslash}X 
  | >{\centering\arraybackslash}X 
  | >{\raggedleft\arraybackslash}X | }
 \hline
 Place/Transition & Explanation & Time  \\
 \hline
 T_1 and T_(2(n+1))  & Robot operation which relates to loadlocks. Transition T_1indicates that wafer unloading from the loadlocks and T_(2(n+1)) means that the robot loads the wafer to the loadlocks. & w \\
\hline
 item 31  & item 32  & item 33 \\

\hline
\end{tabularx}
\end{document}

결과는 다음과 같습니다.

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

아마도 제가 원하는 표 형식의 테이블을 만드는 데 필요한 다른 참고 자료가 있는 분 계시나요?

\begin{tabularx}{0.8\textwidth} 를 \noindent\begin{tabularx}{\linewidth} 로 바꾸면 결과는 다음과 같습니다.

여기에 이미지 설명을 입력하세요 미리 감사드립니다.

답변1

문제는 주석에 명시된 대로 수학 모드에 필요한 구문을 생략한다는 것입니다. 이 때문에 TeX는 _수학 모드에서 유효한 문자인 a를 어느 시점에서 읽게 됩니다. 따라서 자동으로 수학 모드로 전환되지만 수학 모드가 어디에서 끝나야 할지 모르기 때문에 수학 모드에서 조판을 유지하여 이상한 출력이 발생합니다.

수학 모드에 대한 올바른 구문을 사용하면 이 문제를 해결하는 것이 매우 쉽습니다. 열 1과 3에는 문단이 필요하지 않으므로 다른 열 정의로 전환할 수도 있습니다.

\documentclass{article}
\usepackage{tabularx}

\begin{document}
\begin{tabularx}{0.8\textwidth} { |
  l |
  >{\raggedright\arraybackslash}X |
  c |
}
  \hline
  Place/Transition & Explanation & Time  \\
  \hline
  $T_1$ and $T_{2(n+1)}$  & Robot operation which relates to loadlocks. Transition $T_1$ indicates that wafer unloading from the loadlocks and $T_{2(n+1)}$ means that the robot loads the wafer to the loadlocks. & w \\
  \hline
  item 31 & item 32 & item 33 \\
  \hline
\end{tabularx}
\end{document}

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

booktabs셀 사이의 테두리 양을 줄이는 데 도움이 되는 패키지 의 도움으로 대체 솔루션을 만들 수 있습니다 .

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\renewcommand{\arraystretch}{1.25}
\begin{tabularx}{0.8\textwidth} { 
  l 
  >{\raggedright\arraybackslash}X 
  c 
}
  \toprule
  Place/Transition & Explanation & Time  \\
  \midrule
  $T_1$ and $T_{2(n+1)}$  & Robot operation which relates to loadlocks. Transition $T_1$ indicates that wafer unloading from the loadlocks and $T_{2(n+1)}$ means that the robot loads the wafer to the loadlocks. & w \\
  item 31 & item 32 & item 33 \\
  \bottomrule
\end{tabularx}
\end{document}

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


2열 레이아웃에서 테이블을 텍스트 열 너비까지 확장하려는 경우 다음 0.8\textwidth으로 바꿀 수 있습니다 .\linewidth

\documentclass[journal]{IEEEtran}
\usepackage{lipsum}
\usepackage{tabularx}

\begin{document}

\lipsum[1]

\noindent%
\begin{tabularx}{\linewidth} { |
  l |
  >{\raggedright\arraybackslash}X |
  c |
}
  \hline
  Place/Transition & Explanation & Time  \\
  \hline
  $T_1$ and $T_{2(n+1)}$  & Robot operation which relates to loadlocks. Transition $T_1$ indicates that wafer unloading from the loadlocks and $T_{2(n+1)}$ means that the robot loads the wafer to the loadlocks. & w \\
  \hline
  item 31 & item 32 & item 33 \\
  \hline
\end{tabularx}

\newpage

Right column

\end{document}

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

답변2

다음은 두 번째 테이블을 보완하는 아이디어입니다.@JasperHabicht의 답변: 양쪽 끝의 공백 패딩을 제거하고 열 1에 줄바꿈을 허용합니다.

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

\documentclass{article}
\usepackage{tabularx} % for 'tabularx' env. and 'X' column type
\usepackage{booktabs} % for well-spaced horizontal rules
\usepackage{ragged2e} % for '\RaggedRight' macro
\newlength\mylen

\begin{document}

\begin{center}
\settowidth\mylen{Transition} % target width of column 1
\begin{tabularx}{0.8\textwidth} {@{} 
     >{\RaggedRight}p{\mylen} >{\RaggedRight}X c @{}}
 \toprule
 Place\slash Transition & Explanation & Time  \\
 \midrule
 $T_1$ and $T_{2(n+1)}$  & 
 Robot operation which relates to loadlocks. Transition $T_1$ indicates that wafer unloading from the loadlocks, and $T_{2(n+1)}$ means that the robot loads the wafer to the loadlocks. & 
 $w$ \\
 \addlinespace
 item 31 & item 32 & item 33 \\
 \bottomrule
\end{tabularx}
\end{center}
\end{document}

관련 정보