1

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.

migrated from stackoverflow.com Mar 25 '13 at 8:52

This question came from our site for professional and enthusiast programmers.

  • I don't see why you would want automatic line breaks and use all possible space. By definition using all possible space precludes the use of line breaks. – Mythio Mar 25 '13 at 9:06
  • I may have misunderstood, but when I use the tabbing environment I have to manually input every line break in order to have any break whatsoever. – user2205595 Mar 25 '13 at 10:01
  • Yes that is true. Would it be possible to use an adapated list environment perhaps, as is done here: tex.stackexchange.com/questions/5946/…. – Mythio Mar 25 '13 at 12:01
  • I think you set me on the right track there. I haven't tested it fully yet, but it seems that \tabto does what I wanted \tabbing i.e. allows me to tab but retains automatic line breaking. – user2205595 Mar 25 '13 at 14:24
  • Donald Arseneau just came out with a new version of the tabto package (MAR 13), which includes the syntax \tabto*{\TabPrevPos} to return to the location where you last left off. It is great for marginpar kind of approaches. I have a copy of the package, but I don't think it is on CTAN yet, but I asked him to put it there. – Steven B. Segletes Mar 29 '13 at 9:49
1

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$.

  • Thanks for your help! Am I right in thinking that I can't use \obeylines within tabbing? If so, is it possible to modify this (sorry if this is obvious) in such a way to have those things I had previously tabbed be aligned horizontally? Sorry if this requirement wasn't clear in my original question. – user2205595 Mar 25 '13 at 9:43
  • @user2205595: I've added some detail to obtain the desired alignment. – Werner Mar 25 '13 at 18:02
  • Thanks a lot, I'll look at this more thoroughly when I come back to this document. – user2205595 Mar 29 '13 at 9:13
0

I found the \tabto package (http://ftp.uni-erlangen.de/mirrors/CTAN/macros/latex/contrib/tabto/tabto-doc.pdf) did precisely what I wanted, in that I can have a tab feature and still have automatic line breaking.

  • I suspect that tabto isn't a package, but a macro or an environment. Please add more detail to your "answer". – lockstep Mar 25 '13 at 17:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.