6

I'm sure this is trivial, but I'm new to LaTeX and having trouble getting some formatting correct. I want two columns with bold headings and non bold text after. One of the headings, "experiments" has too much info to fit on one line so I want the spacing to be tighter. I've tried several different options but I can't get it right. Here's my attempt at a 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
  • 1
    You're missing a blank line before \doublespacing\textbf{Lab Partner:} Marcus
    – egreg
    Apr 4, 2014 at 12:53

1 Answer 1

7

You're missing a blank line before

\doublespacing
\textbf{Lab Partner:} Marcus

The paragraph has not yet ended, so \doublespacing takes over.

However, I'd do it differently from switching between double and single spacing: set (locally) a non zero \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}

enter image description here

If your data are always laid out as shown, perhaps a template form is better:

\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}
9
  • Thank you! Exactly how I would like it to look. I also discovered that \begin{singlespace}..\end{singlespace} gave good results, but I like your solution better.
    – JayCle
    Apr 4, 2014 at 13:14
  • Needed to say, \baselineskip is really a lot. One might prefer something smaller, like 2ex.
    – yo'
    Apr 4, 2014 at 13:38
  • @tohecz It depends; this seems a lab notes heading, so it might be a good choice.
    – egreg
    Apr 4, 2014 at 13:41
  • 1
    @JayCle I have added an alternative version that might ease typing those headers.
    – egreg
    Apr 4, 2014 at 13:46
  • 1
    @JayCle That's the key-value interface provided by expl3, the programmer's interface of LaTeX3. If you do texdoc interface3 you'll find the documentation.
    – egreg
    Apr 4, 2014 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .