General ⇒ paragraph with vertical rule on the side?
paragraph with vertical rule on the side?
is there a way I can have a vertical rule on the left side of a paragraph? I tried with minipage but the problem is I can't figure out a way to determine the height of the rule, since the rule should depend on the height of the paragraph...Of course there's no point in doing it manually everytime..
What i have is mind is what the "changebar" package does, only I do not want it for revisioning..
thanks in advance!
sotiris
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
paragraph with vertical rule on the side?
If you finally decide to try other approach, perhaps you may find useful the following code:
Code: Select all
\newsavebox{\mybox}
\newlength{\mydepth}
\newlength{\myheight}
\newenvironment{sidebar}%
{\begin{lrbox}{\mybox}\begin{minipage}{\textwidth}}%
{\end{minipage}\end{lrbox}%
\settodepth{\mydepth}{\usebox{\mybox}}%
\settoheight{\myheight}{\usebox{\mybox}}%
\addtolength{\myheight}{\mydepth}%
\noindent\makebox[0pt]{\hspace{-20pt}\rule[-\mydepth]{1pt}{\myheight}}%
\usebox{\mybox}}
Put the above code in the preamble and try something like
Code: Select all
\begin{sidebar}
Text text text text \par
More lines of text ....\par
Text text text.
\end{sidebar}
Re: paragraph with vertical rule on the side?
I have searched and searched over the web to find how to do this, but I couldn't.. how do you even learn to construct such things?? is there a special tutorial for this? i have looked in books and tutorials but i don't think they cover that sort of thing..
thanks again,
sotiris
ps. is it too troublesome to change the colour of the rule? eg to gray?

paragraph with vertical rule on the side?
how do you even learn to construct such things?? is there a special tutorial for this? i have looked in books and tutorials but i don't think they cover that sort of thing..
This kind of things are in good books like The LaTeX Companion, by Goosens et al., A Guide to LaTeX2e, by Kopka and Daly, and, of course, LaTeX: A Document Preparation System, by Lamport. I recommend you to buy, if you can, one of these books.
is it too troublesome to change the colour of the rule? eg to gray?
Add \usepackage{color} to the preamble and insert, for example, \color[gray]{0.3} just before \rule in the definition of sidebar. Read the documentation of the color package to learn how to specify colors. You can use instead the xcolor package for a more sophisticated manipulation of colors.
Re: paragraph with vertical rule on the side?
thaaanks!