表を段落内のテキストに揃えることができませんでした

表を段落内のテキストに揃えることができませんでした

私のドキュメントには表がありますが、表がテキストと垂直に揃っていないため、見た目が非常に醜く見えます。スクリーンショットと私の試みを見ることができます。 ここに画像の説明を入力してください

試す:

\mbox{}\vskip1cm
\begin{table}[t]
\centering\setcellgapes{3pt}\makegapedcells
\captionsetup{format=hang}
\setlength\tabcolsep{3.5pt}%\small
\begin{tabular}{|c|c|c|c|}
        \cline{2-4}
    \multicolumn{1}{c|}{} & \makecell{Application Layer\\Layer 7} & \makecell{Transport \& Network Layer\\Layer 4 \& 3} & \makecell{Data Link \& Physical Layer\\Layer 2 \& 1}\\
    \hline
    WAN & IEC 62056/COSEM & TCP/IP & \makecell{IEC 62056/COSEM\\ PLC G3\\Fibre VLAN}\\
       \hline
    HAN & \makecell{ZigBee Smart Energy 1.0/2.0\\EN 13757-3 M-Bus\\IEC 62056/COSEM\\EN 50090-3} & \makecell{ZigBee 2.0\\EN 50090-4} & \makecell{ZigBee\\PLC\\EN 13757-2 M-Bus\\EN 50090-4}\\
     \hline
    \end{tabular}
    \caption{The standardization bodies CEN, CENELEC and ETSI identify smart metering European data exchange and communication standards which are categorized by depending on the network layer model and the network size.}
    \label{table:standards}
   \end{table}

In addition, the CEN/CENELEC TC 205 technical committee ....

どなたか、テーブルを tex に合わせるのを手伝っていただけませんか。他のテーブルでも同様の問題があるため、私にとっては非常に重要な問題です。

答え1

tabularxを使用して、セルの 1 つに線を追加できます。また、よりプロフェッショナルな外観にするには、垂直罫線ではなくbooktabs、罫線の周囲に垂直方向の余白を追加する の可変幅罫線を使用することをお勧めします。

両方の例を以下に示します。

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{array, makecell, caption, tabularx, booktabs}
\renewcommand{\tabularxcolumn}[1]{>{\centering\arraybackslash}p{#1}}
\renewcommand\cellalign{tc}

\begin{document}
\mbox{}\vspace{1cm}
\begin{table}[!htb]
\centering\setcellgapes{3pt}\makegapedcells
\captionsetup{format=hang}
\setlength\tabcolsep{3.5pt}%\small
\begin{tabularx}{\linewidth}{|c|X|X|X|}
    \cline{2-4}
\multicolumn{1}{c|}{} & \makecell{Application Layer\\Layer 7} & \makecell{Transport \& Network Layer\\Layer 4 \& 3} & \makecell{Data Link \& Physical Layer\\Layer 2 \& 1}\\
\hline
WAN & IEC 62056/COSEM & TCP/IP &\makecell{[IEC 62056/COSEM\\ PLC G3\\Fibre VLAN}\\
   \hline
HAN & \makecell{ZigBee \\Smart Energy 1.0/2.0\\EN 13757-3 M-Bus\\IEC 62056/COSEM\\EN 50090-3} & \makecell{ZigBee 2.0\\EN 50090-4} & \makecell{ZigBee\\PLC\\EN 13757-2 M-Bus\\EN 50090-4}\\
 \hline
\end{tabularx}
\caption{The standardization bodies CEN, CENELEC and ETSI identify smart metering European data exchange and communication standards which are categorized by depending on the network layer model and the network size.}
\label{table:standards}
\end{table}

In addition, the CEN/CENELEC TC 205 technical committee ....

\begin{table}[!htb]
\centering\setcellgapes{3pt}\makegapedcells
\captionsetup{format=hang}
\setlength\tabcolsep{3.5pt}%\small
\begin{tabularx}{\linewidth}{cXXX}
    \cmidrule[\heavyrulewidth]{2-4}
& \makecell{Application Layer\\Layer 7} & \makecell{Transport \& Network Layer\\Layer 4 \& 3} & \makecell{Data Link \& Physical Layer\\Layer 2 \& 1}\\
\cmidrule{2-4}
WAN & IEC 62056/COSEM & TCP/IP &\makecell{[IEC 62056/COSEM\\ PLC G3\\Fibre VLAN}\\
   \addlinespace
HAN & \makecell{ZigBee \\Smart Energy 1.0/2.0\\EN 13757-3 M-Bus\\IEC 62056/COSEM\\EN 50090-3} & \makecell{ZigBee 2.0\\EN 50090-4} & \makecell{ZigBee\\PLC\\EN 13757-2 M-Bus\\EN 50090-4}\\
    \cmidrule[\heavyrulewidth]{2-4}
\end{tabularx}
\caption{The standardization bodies CEN, CENELEC and ETSI identify smart metering European data exchange and communication standards which are categorized by depending on the network layer model and the network size.}
\label{table:standards}
\end{table}
\end{document} 

ここに画像の説明を入力してください

関連情報