
열 머리글 중 하나에 줄 바꿈이 필요합니다. 이전 게시물의 제안 사항을 사용해 보았으나 열 머리글이 방정식이므로 사용할 수 없었습니다. 아래와 같이 4번째 열의 열 머리글에 줄 바꿈이 필요합니다.
내가 작성한 코드는 다음과 같습니다.
\begin {table}[h]
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
$i$ & $Degree \phi_i$ & $\cos(\phi_i)$ & Product of $\cos(\phi_i)\par K=\prod K_i=\prod\cos(\phi_i)$ \\
\end{tabular}
\end{center}
\end {table}
미리 감사드립니다
답변1
언제든지 표 형식 안에 표 형식을 넣을 수 있습니다.
\documentclass{article}
\begin{document}
\begin {table}[h]
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
$i$ & Degree $\phi_i$ & $\cos(\phi_i)$ &\begin{tabular}{@{}l} Product of $\cos(\phi_i)$\\$ K=\prod K_i=\prod\cos(\phi_i)$
\end{tabular} \\
\end{tabular}
\end{center}
\end {table}
\end{document}
(달러 기호의 다른 사용법을 관찰하십시오).
답변2
패키지 이용을 추천드립니다 makecell
. 열 머리글과 셀의 줄 바꿈에 공통 서식을 적용할 수 있습니다. 또한 수직선이 없으면 테이블이 더 좋아 보일 것입니다. 패키지 booktabs
는 가변 두께와 이러한 규칙 주위에 일부 수직 패딩을 사용하여 가로 규칙을 정의합니다. 나는 center
환경(테이블 주위에 수직 간격을 추가하는)을 간단한 \centering
지시문으로 대체했습니다. 마지막으로, siunitx
숫자 열의 정밀한 형식 지정을 위한 패키지가 있습니다.
\documentclass[twoside]{report}
\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{ table-format=1.8,table-number-alignment=center}
\usepackage{makecell}
\usepackage{cellspace}
\setcellgapes[t]{3pt}
\setcellgapes[b]{1pt}
\renewcommand\theadfont{\bfseries\boldmath}
\begin{document}
\begin {table}[h]
\centering\makegapedcells
%\begin{tabular}{|l|S[table-format=2.8]|*{2}{S|}}
%\hline
\begin{tabular}{lS[table-format=2.8]*{2}{S}}
\toprule
{\thead{$i$}} & {\thead{Degree $\phi_i$}} & {\thead{$\cos(\phi_i)$}} & {\thead{Product of $\cos(\phi_i) $ \\ $K=\prod K_i=\prod\cos(\phi_i)$}} \\
\midrule
1 & 45.00000000 & 0.70710700 & 0.70710678 \\
2 & 26.56505118 & 0.89442700 & 0.63245553 \\
3 & 14.03624347 & 0.97014300 & 0.60883391 \\
4 & 7.12501635 & 0.99227800 & 0.60764826 \\
\bottomrule
\end{tabular}
\end {table}
\end{document}
답변3
이 경우 간단한 왼쪽 정렬 스택이 가능합니다. 또한 기본값보다 더 많은 수평선을 오프셋하기 위해 스택 위/아래에 수직 버퍼를 추가합니다.
\documentclass{article}
\usepackage{stackengine}
\begin{document}
\begin {table}[h]
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
$i$ & Degree $\phi_i$ & $\cos(\phi_i)$ & \def\stackalignment{l}
\addstackgap[2pt]{%
\stackunder{Product of $\cos(\phi_i)$}{$K=\prod K_i=\prod\cos(\phi_i)$}} \\
\hline
\end{tabular}
\end{center}
\end {table}
\end{document}
매크로를 변경하면 스택의 수직 정렬이 중앙 구성으로 변경됩니다 \stackunder
.\stackanchor