[Tex/LaTex] Tabbing and automatic line breaks without columns

line-breakingtabbing

I'm making dense revision notes so I'm trying to use all space possible e.g. tabbing and adding short notes whenever the previous item takes up significantly less than half the line

\begin{tabbing}
Defns 1.0: Graph, vert, edge, adj, $E_n$,$K_n$,$P_n$,\=$C_n$, sbgraph, induced graph,     connected,\\ components, forest, tree\\
....
Thm 2.1: (Hall's Marriage Theorem)\>Cor 2.2: (Defect Form)\\
....
Thm 2.5: (Menger)\>Cor 2.6: Menger for subsets\

But I would also like to have automatic line breaks. I don't think any table type environment would suit me since I elsewhere want text to fill the whole line (i.e. not be confined to one column). However I would still like to be able to align the things I have previously been tabbing.

Best Answer

Perhaps you might be interested in using \obeylines:

enter image description here

\documentclass{article}
\setlength{\parindent}{0pt}
\begin{document}
\begingroup\obeylines
\textbf{Graph Theory}
\textbf{\S1. Definitons and Miscellany}
Defns 1.0: Graph, vert, edge, adj, $E_n$, $K_n$, $P_n$,~$C_n$, sbgraph, induced graph, connected,
components, forest, tree
Thm 1.1: two equivalent characterisations of trees
\ldots
\textbf{\S2. Connectivity and Matching}
Defns 2.1.0: matching, independent, 1-factor
Thm 2.1: (Hall's Marriage Theorem) \quad Cor 2.2: (Defect Form)
Cor 2.3: (Polyandrous version)
\endgroup

\bigskip

Here
is
some
text
\end{document}

Using \obeylines allow you to drop the use of \\ for line-breaking, while wrapping occurs naturally. Also, scoping it inside \begingroup...\endgroup localizes the effect, as you can see in the end of the minimal example, where regular line-breaking is re-instated as spaces.


To maintain an alignment similar to tabbing, you could use some box-manipulation through \phantom and overlaps:

enter image description here

\begingroup\obeylines\raggedright
...
\textbf{\S2. Connectivity and Matching}
Defns 2.1.0: matching, independent, 1-factor
\mbox{}\rlap{Thm 2.1: (Hall's Marriage Theorem)}%
\phantom{Defns 1.0: Graph, vert, edge, adj, $E_n$, $K_n$, $P_n$,~}Cor 2.2: (Defect Form)
Cor 2.3: (Polyandrous version)
...
\endgroup

Note that the alignment is only achieved when there is no full line in the alignment of the "parent", otherwise the inter-word stretch might affect it. As an immediate resolution, I've used \raggedright.

\mbox "initiates" a paragraph, while \rlap inserts a zero-width box that is left-aligned/justified. This causes the so-called right overlap. Then, \phantom{<stuff>} sets <stuff> as a blank box so your alignment starts at the right spot again, immediately in line (horizontally) with $C_n$.