简体   繁体   English

LATEX 中表格内的字体大小不一致

[英]Inconsistent font size inside Tables in LATEX

I am facing a sudden increase in fontsize inside a table in my document.我的文档中表格内的字体大小突然增加。

Here, the scheme stands for the protocol used to establish the connection. Hostname implies the domain name or the IP Address of the host where the server runs. Port is the TCP port on which server is found, while path gives the provision of additional data facilitating the identification of a specific server. The mapping can be better understood in the table \ref{Tablemapping}.
 
  \begin{table}[ht]
  
  \begin{center}
    \resizebox{\textwidth}{!}{
    \begin{tabular}{|c|p{8cm}|} % <-- Alignments: 1st column left, 2nd middle and 3rd right, with vertical lines in between
    \hline
      \textbf{URL Field} & \textbf{Mapping} \\  
      \hline
     scheme & Scheme maps to the SRV record service field. Currently following mappings are defined. In this thesis, we are using the opc.tcp mapping.
     \begin{tabular}{|c|c|} 
     \hline
     opc.tcp & \textunderscore opcua-tcp.\textunderscore tcp.\\
     \hline
      opc.wss & \textunderscore opcua-tls.\textunderscore tcp.\\
      \hline
      https & \textunderscore opcua-https.\textunderscore tcp.\\
       \hline
     \end{tabular}\\
      \hline
       hostname & Maps on to the target field of the SRV Record\\
        \hline
        port & Maps to the SRV record port field \\
        \hline
        path & Maps on the path string specified in the TXT record\\
        \hline
        
    
    
    \end{tabular}
    }
    \caption{\textit{DiscoveryUrl} to SRV and TXT Record mapping\citep{Part12}}
    \label{Tablemapping}
  \end{center}
  \end{table}
 

And the corresponding image is as shown here: LatexObservation并且对应的图像如下所示: LatexObservation

Please guide me to resolve this issue请指导我解决此问题

Don't use \resizebox for anything that contains text!不要将\resizebox用于包含文本的任何内容! Of course this will mess up the font size!当然这会弄乱字体大小!

If you would like your table to fill the whole line, you can use a tabularx :如果您希望表格填满整行,可以使用tabularx

\documentclass{article}

\usepackage{tabularx}

\begin{document}
    
Here, the scheme stands for the protocol used to establish the connection. Hostname implies the domain name or the IP Address of the host where the server runs. Port is the TCP port on which server is found, while path gives the provision of additional data facilitating the identification of a specific server. The mapping can be better understood in the table \ref{Tablemapping}.
 
  \begin{table}[ht]
  \centering
    \begin{tabularx}{\linewidth}{|c|X|}
    \hline
      \textbf{URL Field} & \textbf{Mapping} \\  
      \hline
     scheme & Scheme maps to the SRV record service field. Currently following mappings are defined. In this thesis, we are using the opc.tcp mapping.
     \begin{tabular}{|c|c|} 
     \hline
     opc.tcp & \textunderscore opcua-tcp.\textunderscore tcp.\\
     \hline
      opc.wss & \textunderscore opcua-tls.\textunderscore tcp.\\
      \hline
      https & \textunderscore opcua-https.\textunderscore tcp.\\
       \hline
     \end{tabular}\\
      \hline
       hostname & Maps on to the target field of the SRV Record\\
        \hline
        port & Maps to the SRV record port field \\
        \hline
        path & Maps on the path string specified in the TXT record\\
        \hline
    \end{tabularx}
    \caption{\textit{DiscoveryUrl} to SRV and TXT Record mapping\cite{Part12}}
    \label{Tablemapping}
  \end{table}

\end{document}

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM