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

问题描述

我的文档中的表格中的字体大小突然增加

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}
 

对应的图片如下所示: LatexObservation

请指导我解决此问题

解决方法

不要将 \resizebox 用于任何包含文本的内容!当然这会弄乱字体大小!

如果您希望表格填满整行,可以使用 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}

enter image description here