GeneralSide notes along an outline

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
strider1551
Posts: 2
Joined: Thu Aug 21, 2014 10:10 pm

Side notes along an outline

Post by strider1551 »

I'm trying to do a complex layout that I've yet to find a good solution for. A significant amount of my text is an outline with multiple levels, which in the past I have used easylist for. In my next project, though, I have a lot of one-line references that I want to run to the right of the outline, on the exact line for the reference.

I don't want these to be typical marginal notes, though, because these documents have a small marginal space that wouldn't accommodate; they also consist of more than outlines, so if I change the margin size to accommodate there would be a ton of margin space for no reason in everything else. Plus, I want them on the exact line, not floating.

This is what I've come up with so far (borrowing an example from another topic):

Code: Select all

\documentclass{article}
\usepackage[letterpaper,margin=0.75in]{geometry}

\usepackage{lipsum}
\usepackage{tabularx}

\usepackage[sharp]{easylist}
	\ListProperties(Indent=2em,Hang=true,FinalMark2=,%
			Margin2=2em,Margin3=4.9em,%
			Align=move,FinalSpace=1em,%
			Hide3=2,%
			Style1=\bfseries\scshape)
					
\makeatletter
\newcommand\currlinewidth{\dimexpr\textwidth-\el@TotalMargin\relax}
\newcommand\notewidth{\dimexpr\textwidth-\el@TotalMargin-1in\relax}
\makeatother

\begin{document}

\lipsum[1]\bigskip

\begin{easylist}
	# Section
	##  \renewcommand{\tabcolsep}{2pt}
	    \begin{tabularx}{\currlinewidth}{ p{\notewidth} >{\raggedleft\arraybackslash}X }
		A really long note that might take several lines to explain because, you know, information and stuff. But no, seriously, sometimes there's like a whole paragraph here with all kinds of crazy things. & DN 2.10.1
	    \end{tabularx}
	### \renewcommand{\tabcolsep}{2pt}
	    \begin{tabularx}{\currlinewidth}{ p{\notewidth} >{\raggedleft\arraybackslash}X }
	   	But not always. & AC 1.5.6
	    \end{tabularx}
	### \renewcommand{\tabcolsep}{2pt}
	    \begin{tabularx}{\currlinewidth}{ p{\notewidth} >{\raggedleft\arraybackslash}X }
		Some don't need a reference, but without a tabularx environment it overflows into the reference space. & 
	    \end{tabularx}
\end{easylist}
	
\end{document}
example.png
example.png (79.77 KiB) Viewed 3987 times
My problems with what I have:
  • The outline numbers are being vertically aligned in the center, not the top.
  • Line spacing in outline seems to get confused? (see lack of space below "Section")
  • Just for my own sanity, the source is pretty hard to read with the repeated begin/end tabularx, and God forbid pages into it I realize I need to make a change in all of those.
I'm also open to suggestions of other ways to do what I want.
Last edited by cgnieder on Fri Aug 29, 2014 10:55 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

strider1551
Posts: 2
Joined: Thu Aug 21, 2014 10:10 pm

Side notes along an outline

Post by strider1551 »

Found my own solution. I stopped using easylist or any other list structures, and instead made some of my own counters.

Code: Select all

\documentclass{article}
\usepackage[letterpaper,margin=0.75in]{geometry}

\usepackage{lipsum}
\usepackage{tabularx}
\usepackage{calc}

\newcounter{firstcount}
\newcounter{secondcount}
\newcounter{thirdcount}
\newcommand{\first}{%
	\stepcounter{firstcount}%
	\setcounter{secondcount}{0}%
	\setcounter{thirdcount}{0}%
	\bfseries %
	\hangindent=25pt\hspace*{0pt}\makebox[25pt][l]{\thefirstcount.}%
}
\newcommand{\second}{%
	\stepcounter{secondcount}%
	\setcounter{thirdcount}{0}%
	\hangindent=50pt\hspace*{25pt}\makebox[25pt][l]{\thefirstcount.\thesecondcount}%
}
\newcommand{\third}{%
	\stepcounter{thirdcount}%
	\hangindent=75pt\hspace*{50pt}\makebox[25pt][l]{\thethirdcount.}%
}
% Counters need to be reset if there are separate outlines in one document.
\newcommand{\reset}{%
	\setcounter{firstcount}{0}%
	\setcounter{secondcount}{0}%
	\setcounter{thirdcount}{0}%	
}

\begin{document}

\lipsum[1]
\bigskip

\noindent
\setlength{\tabcolsep}{0pt}
\begin{tabularx}{\textwidth}{ @{} p{\textwidth-1in} >{\raggedleft\arraybackslash}X @{} }
	\first Section & \\
	\second A really long note that might take several lines to explain because, you know, information and stuff. But no, seriously, sometimes there's like a whole paragraph here with all kinds of crazy things. & DN 2.10.1 \\
	\third But not always. & AC 1.5.6 \\
	\third Some don't need a reference, but we still don't want it to overflow into the reference space. &  \\
\end{tabularx}

\end{document}
example2.png
example2.png (75.78 KiB) Viewed 3987 times
Last edited by cgnieder on Fri Aug 29, 2014 10:56 am, edited 1 time in total.
Post Reply