控制段后间距

控制段后间距

我确信这很简单,但我刚开始使用 LaTeX,在设置正确的格式方面遇到了麻烦。我想要两列,标题为粗体,后面是非粗体文本。其中一个标题“实验”包含的信息太多,一行放不下,所以我希望间距更紧密。我尝试了几种不同的方法,但都无法正确设置。这是我对 MWE 的尝试:

\documentclass[11pt,letterpaper]{article}
\usepackage[left=1.1in,right=1.1in,top=1.1in,bottom=1.1in]{geometry}
\usepackage{setspace}
\begin{document}
%% Heading Section%%
\begin{minipage}[t]{0.5\textwidth}
\doublespacing
\raggedright
\textbf{Name:} Jayson \\
\textbf{Course Number:} ECGR 2155\\
\textbf{Experiment Titles:}\\
\singlespacing
    Network Analysis,
    Th\'{e}venin and Norton Circuits,
    Time Constant of an RC Network  
\doublespacing  
\textbf{Lab Partner:} Marcus \\
\end{minipage}
\hfill
\begin{minipage}[t]{0.5\textwidth}
\doublespacing
\textbf{Date:} \today\\
\textbf{Section:} L03 \\
\textbf{Experiment Numbers:} 8,9,10\\
\end{minipage}
\end{document}

答案1

你之前少了一个空行

\doublespacing
\textbf{Lab Partner:} Marcus

该段落尚未结束,因此\doublespacing接管。

但是,我的做法与在双倍行距和单倍行距之间切换不同:(本地)设置一个非零值\parskip

\documentclass[11pt,letterpaper]{article}
\usepackage[left=1.1in,right=1.1in,top=1.1in,bottom=1.1in]{geometry}
\begin{document}
%% Heading Section%%
\noindent\begin{minipage}[t]{0.5\textwidth}
\setlength{\parskip}{\baselineskip}
\raggedright
\textbf{Name:} Jayson

\textbf{Course Number:} ECGR 2155

\textbf{Experiment Titles:}\\
Network Analysis,
Th\'{e}venin and Norton Circuits,
Time Constant of an RC Network

\textbf{Lab Partner:} Marcus
\end{minipage}\hfill
\begin{minipage}[t]{0.5\textwidth}
\setlength{\parskip}{\baselineskip}
\textbf{Date:} \today

\textbf{Section:} L03

\textbf{Experiment Numbers:} 8,9,10
\end{minipage}
\end{document}

在此处输入图片描述

如果您的数据总是如图所示布局,那么模板形式可能更好:

\documentclass[11pt,letterpaper]{article}
\usepackage[left=1.1in,right=1.1in,top=1.1in,bottom=1.1in]{geometry}
\usepackage{tabularx,array}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\headingsection}{m}
 {
  \keys_set:nn { labnotes/heading } { #1 }
  \par\noindent
  \begin{tabular}{
    @{}
    >{\raggedright}p{\dim_eval:n{.5\textwidth-\tabcolsep}}
    >{\raggedright\arraybackslash}p{\dim_eval:n{.5\textwidth-\tabcolsep}}
    @{}
  }
  \textbf{Name:}~\l_labnotes_heading_name_tl &
  \textbf{Date:}~\l_labnotes_heading_date_tl \\[\baselineskip]
  \textbf{Course~Number:}~\l_labnotes_heading_coursenumber_tl &
  \textbf{Section:}~\l_labnotes_heading_section_tl \\[\baselineskip]
  \textbf{Experiment~Titles:}~\newline\l_labnotes_heading_exptitles_tl
    % add here the spacing
    \vspace{\baselineskip} &
  \textbf{Experiment~Numbers:}~\l_labnotes_heading_expnumbers_tl\vspace{\baselineskip} \\
  \textbf{Lab~Partners:}~\l_labnotes_heading_partners_tl
  \end{tabular}
  \par
 }

\keys_define:nn { labnotes/heading }
 {
  name .tl_set:N = \l_labnotes_heading_name_tl,
  date .tl_set:N = \l_labnotes_heading_date_tl,
  coursenumber .tl_set:N = \l_labnotes_heading_coursenumber_tl,
  section .tl_set:N = \l_labnotes_heading_section_tl,
  exptitles .tl_set:N = \l_labnotes_heading_exptitles_tl,
  expnumbers .tl_set:N = \l_labnotes_heading_expnumbers_tl,
  partners .tl_set:N = \l_labnotes_heading_partners_tl,
 }
\ExplSyntaxOff

\begin{document}

\headingsection{
  name=Jayson,
  date=\today,
  coursenumber=ECGR 2155,
  section=L03,
  exptitles={
    Network Analysis,
    Th\'{e}venin and Norton Circuits,
    Time Constant of an RC Network
  },
  expnumbers={8, 9, 10},
  partners=Marcus,
}
\end{document}

相关内容