表格中的行距問題

表格中的行距問題

在下面的程式碼中,描述了一個表。第二條水平線似乎被文字行弄髒了。

我該如何修正這個問題?

黃色突出顯示

那麼問題是:如何增加行與文字之間的行間距?

 \resheading{\textbf{ACADEMIC DETAILS} }\\[\lsep]
\vspace{5mm} \vfill
%\begin{table}[ht!]
%\begin{center}
\indent \begin{tabular}{ l @{\hskip 0.15in} l @{\hskip 0.20in} l @{\hskip 0.20in} l @{\hskip 0.20in} l }
\hline
\vspace{0.1mm}
\textbf{Year} &\textbf{Degree} & \textbf{Institute}   & \textbf{CGPA/\%} \\
\hline
2015- Present&B.Tech Electrical and Electronics Engineering & VIT Vellore  & 9.69 CGPA \\

2015 & 12th CBSE Board Examination & Kendriya Vidyalaya & 94.8\%\\

2013 & 10th CBSE Board Examination & Kendriya Vidyalaya & 10 CGPA\\
\hline
\end{tabular}
%\end{center}
%\end{table}
\vspace{2mm}

%\resheading{\textbf

答案1

另一個解決方案包括定義一個最小的單元格頂部和底部與cellspace包的垂直填充:

\documentclass{article}

\usepackage[top=0.75in, bottom=0.75in, left=0.55in, right=0.85in]{geometry}

\usepackage{booktabs}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

\centering
    \begin{tabular}{@{}*{4}{Sl}@{}}
        \toprule
        \textbf{Year} &\textbf{Degree} & \textbf{Institute} & \textbf{CGPA/\%}\\
        \midrule
        2015 -- present & B.Tech Electrical and Electronics Engineering & VIT Vellore & 9.69 CGPA\\
        2015 & 12th CBSE Board Examination & Kendriya Vidyalaya & 94.8\%\\
        2013 & 10th CBSE Board Examination & Kendriya Vidyalaya & 10 CGPA\\
        \bottomrule
    \end{tabular}

\end{document} 

在此輸入影像描述

答案2

作為Alan Munn 在他的評論中也建議: 別擔心,讓我們來booktabs解決您的問題:

\documentclass{article}

\usepackage[top=0.75in, bottom=0.75in, left=0.55in, right=0.85in]{geometry}

\usepackage{booktabs}
\usepackage{tabularx}

\begin{document}

    \begin{tabularx}{\dimexpr\linewidth-15pt}{@{}lXll@{}}
        \toprule
        \textbf{Year} &\textbf{Degree} & \textbf{Institute} & \textbf{CGPA/\%}\\
        \midrule
        2015 -- present & B.Tech Electrical and Electronics Engineering & VIT Vellore & 9.69 CGPA\\
        2015 & 12th CBSE Board Examination & Kendriya Vidyalaya & 94.8\%\\
        2013 & 10th CBSE Board Examination & Kendriya Vidyalaya & 10 CGPA\\
        \bottomrule
    \end{tabularx}

\end{document}

在此輸入影像描述

答案3

像這樣?

在此輸入影像描述

正如建議的艾倫·穆恩在他的評論中,包中的規則booktabs在單元格內容周圍提供了更多的垂直空間。除此之外,還\arraystretch增加並刪除了列之間多餘的手動間距。

{\renewcommand\arraystretch{1.2}
\begin{tabular}{ l l l l l }
\midrule
\textbf{Year} 
     & \textbf{Degree}  & \textbf{Institute}   & \textbf{CGPA/\%}   \\
\midrule
2015- Present
     & B.Tech Electrical and Electronics Engineering  
                        & VIT Vellore           & 9.69 CGPA         \\

2015 & 12th CBSE Board Examination 
                        & Kendriya Vidyalaya    & 94.8\%            \\

2013 & 10th CBSE Board Examination 
                        & Kendriya Vidyalaya    & 10 CGPA           \\
\midrule
\end{tabular}
}

相關內容