- IN Other
Underlining using the soul package
- Feb 6, 2011 |
- 7 Comments
Underlining content in your LaTeX document can be of great value. Sometimes its necessarily to emphasize certain content or to define a layout in your document. The most straight forward case to do this is to use the \underline command. However, this command does not give you any control about, for instance, the thickness of the underlining. The solution to this is to use the soul package.
The soul package
In the preamble of your document, call the package with \usepackage{soul}. Defining the underlining properties as you like is done with \setul:
\setul{depth}{thickness} |
Both depth and thickness should be defined in terms of ex (x-height). As an example, if you would like to underline content with a 0.8ex thick line at a depth of 1ex, you should enter this in your preamble:
\setul{1ex}{0.8ex} |
Note that the underlining is now independent of the text. When using the standard \underline command, compare \underline{abc} with \underline{gyh}. As you can see, the depth is changed when characters like g and y are underlined.
The depth can also be controlled using \setuldepth. It sets the depth such that the underline’s upper edge lies 1 pt beneath the given argument’s deepest depth:
\setuldepth{g} |
Underlining color
Also, the color of the underlining can be changed with this package. This might be of interest when using LaTeX to create presentation slides. To change the color of the underlining, we use \setulcolor. To define a color in LaTeX, we also need the color package. There are multiple ways to define a color, for instance by choosing a standard color or by defining a custom color. It is explained here how to define a color. If we want the underlining to be orange, we use:
\usepackage{color,soul} \setul{1ex}{0.8ex} \definecolor{orange}{rgb}{1,0.5,0} \setulcolor{orange} |
I was excited to land on this post. I wanted to thank you for writing this excellent article!! I definitely really liked every little bit of it and I have your site bookmarked so I can read your stuff.
Thank you!
Great Work!
Terrific work! This is the type of info that should be shared around the net. Shame on the search engines for not positioning this post higher! Come on over and visit my website . Thanks =)
The more I read on your blog, the more I’m liking it. Some of your tips are really useful, though I’m not too sure that I want to try them all, lol. In any case, you sound like a really nice person :)
It’s a small world, but I would hate to have to paint it.
i love it
Almost all of whatever you mention happens to be supprisingly legitimate and that makes me wonder why I had not looked at this in this light before. Your piece truly did turn the light on for me personally as far as this subject goes. But there is actually just one position I am not necessarily too cozy with so whilst I make an effort to reconcile that with the actual core theme of your point, permit me see exactly what the rest of your subscribers have to point out.Very well done.