Dear LaTeX gurus,
I was wondering if anybody could help me change the color/thickness of a section underline.
I have used \usepackage{titlesec}
and have used the code
\titleformat{\section}{\Large\raggedright}{}{0em}{}[\titlerule]
%Tweak the top margin
\addtolength{\voffset}{-1.3cm}
How do I change the color/thickness?
I tried
\titleformat{\section}{\Large\raggedright}{}{0em}{}[\titlerule[0.8pt]
]
From what it says in literature but to no avail. It doesn't compile!
Any help would be greatly appreciated
General ⇒ Change the color of linerule
NEW: TikZ book now 40% off at Amazon.com for a short time.

Change the color of linerule
Hi,
Try something along these lines:
As you can see, the optional argument of \titlerule controls the height of the rule; the color can be changed locally with the \color command
Try something along these lines:
Code: Select all
\documentclass{article}
\usepackage{xcolor}
\usepackage{titlesec}
\titleformat{\section}
{\Large\raggedright}
{}{0em}{}[{\color{red}\titlerule[8pt]}]
\begin{document}
\section{Test section}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 8
- Joined: Wed May 05, 2010 8:36 pm
Re: Change the color of linerule
You are a star! Thank you. While I've got your attention. I am using a piece of code
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Fontin Sans}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
where I can select the font from my local library. However when I use certain fonts it doesn't produce the Small Caps style from the \sc declaration. The Small Caps fonts are there as I have checked them against the ones that work. Is there any reason you can think of off the top of your head?
Thank you so much for your help
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Fontin Sans}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
where I can select the font from my local library. However when I use certain fonts it doesn't produce the Small Caps style from the \sc declaration. The Small Caps fonts are there as I have checked them against the ones that work. Is there any reason you can think of off the top of your head?
Thank you so much for your help
Change the color of linerule
That's XeLaTeX code for fontspec. You should be clear you're using XeLaTeX.
I think sometimes fontspec has trouble identifying the right small caps font to use; probably has something to do with the fonts themselves. But fontspec has commands for specifying the exact font to use. I don't have Andale Mono or Gill Sans installed right now, but for Fontin Sans, the following works for me:
(You don't need to repeat Mapping=tex-text if you're already set it to default to that...)
But if we're going to continue on this line, we should start a new thread with an appropriate subject line.
I think sometimes fontspec has trouble identifying the right small caps font to use; probably has something to do with the fonts themselves. But fontspec has commands for specifying the exact font to use. I don't have Andale Mono or Gill Sans installed right now, but for Fontin Sans, the following works for me:
Code: Select all
\documentclass[letterpaper]{article}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[SmallCapsFont={Fontin Sans Small Caps}]{Fontin Sans}
\begin{document}
This is \textsc{small caps}.
\end{document}
But if we're going to continue on this line, we should start a new thread with an appropriate subject line.