Donate

You find LaTeX Community useful? Please donate! Learn why!

Amount:

Partner Sites

goLaTeX
TeXblog
TeXnicCenter

Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 5 minutes)
Most users ever online was 74 on Wed Dec 02, 2009 5:14 pm

Users browsing this forum: No registered users and 6 guests
logo-contest

Create a fancy section heading layout?

LaTeX specific issues not fitting into one of the other forums of this category.

Create a fancy section heading layout?

Postby idaham on Wed May 21, 2008 3:49 pm

Hi!
I have a bit of a problem and wonder if anyone can help me.. I found a very nice document layout, like the one found at "http://www-ra.phys.utas.edu.au/~jstevens/gfx/thesis_p103.jpg" (The chapter number is large, colored and above the chapter title). This layout is meant for the documentclass "book". (The code for the style is found at "http://www-ra.phys.utas.edu.au/~jstevens/code_thesis_style.html"). I wonder if anyone knows how to get the same style for the documentclass "article"? Since there are no chapters in articles, I'm trying to get the style to work on section headings instead, i.e. the section heading should be the same with the section number large and colored, above the section title. I've tried for hours without result! =( Does anyone have some tips how to change the section headings to some fancy layout, I'd be really grateful! Cheers!
/Ida
idaham
 
Posts: 19
Joined: Wed May 21, 2008 3:30 pm

Re: Create a fancy section heading layout?

Postby localghost on Wed May 21, 2008 8:09 pm

The code uses a package called psboxit, which was developed for LaTeX2.09 and therefore must be considered obsolete. A similar style could be achieved by combining the quotchap and the titlesec package. After reading the related documentations, feel free to ask further questions.


Best regards
Thorsten
¹ I'm sorry. My responses are limited. You must ask the right questions.
² A minimal working example (MWE) promises quick help.
³ OS, LaTeX-System, Editor: openSUSE 11.2, TeX Live 2009, TeXworks 0.3 | Windows XP (SP3), MiKTeX 2.8, TeXworks 0.3
User avatar
localghost
Site Moderator
 
Posts: 3567
Joined: Fri Feb 02, 2007 11:06 am
Location: Braunschweig, Germany

Re: Create a fancy section heading layout?

Postby idaham on Thu May 22, 2008 9:15 pm

localghost wrote:The code uses a package called psboxit, which was developed for LaTeX2.09 and therefore must be considered obsolete. A similar style could be achieved by combining the quotchap and the titlesec package. After reading the related documentations, feel free to ask further questions.


Best regards
Thorsten

Hi Thorsten, and thank you for helping me out!
I've tried to look in quotchap.sty to get some ideas, but since I'm a newbie when it comes to LaTex, I didn't completely succeed.. I've written my own sty-file to do what I want, and it looks like:

Code: Select all
\RequirePackage[calcwidth]{titlesec}
\RequirePackage{color}

\definecolor{seccol}{rgb}{0,0.8,0.3}
 
\titleformat{\section}[hang]{\sffamily\bfseries}
{\color{seccol}\Huge\thesection}{0pt}{\linebreak\huge\raggedleft}[{\titlerule[0.5pt]}]


I load this sty-file into a document and the section heading looks quite nice! Although, the section number is too small (\Huge here), and when I try to change it to something bigger, using ex. \fontsize it doesn't work! I've also tried to change the font of the section number (number only, not the section title!), without any success... Should I write those commands somewhere around where I added the \color command? Thanks!
Ida
idaham
 
Posts: 19
Joined: Wed May 21, 2008 3:30 pm

Re: Create a fancy section heading layout?

Postby Hamed on Sat May 24, 2008 12:31 pm

Hi all,
I have a question, using the section format posted above how do you make colorbox around the section name?

Thanks
Hamed
 
Posts: 4
Joined: Sat May 24, 2008 12:27 pm

Re: Create a fancy section heading layout?

Postby localghost on Sat May 24, 2008 2:12 pm

Hamed wrote:Hi all,
I have a question, using the section format posted above how do you make colorbox around the section name?

Thanks

At the moment I have no idea. But perhaps you find some useful hints in the documentation of the titlesec package.


Best regards and welcome aboard
Thorsten

idaham wrote:[...] Although, the section number is too small (\Huge here), and when I try to change it to something bigger, using ex. \fontsize it doesn't work! I've also tried to change the font of the section number (number only, not the section title!), without any success... Should I write those commands somewhere around where I added the \color command? [...]

Just replace the \Huge command in your definition of the section format by the following sequence, which works fine for me.
Code: Select all
\fontsize{36}{42}\selectfont

As you can see, you only have forgotten the \selectfont command to activate the new font size. The second argument of the \fontsize command is the interlinear space and should have about additional 20% of the first value.
¹ I'm sorry. My responses are limited. You must ask the right questions.
² A minimal working example (MWE) promises quick help.
³ OS, LaTeX-System, Editor: openSUSE 11.2, TeX Live 2009, TeXworks 0.3 | Windows XP (SP3), MiKTeX 2.8, TeXworks 0.3
User avatar
localghost
Site Moderator
 
Posts: 3567
Joined: Fri Feb 02, 2007 11:06 am
Location: Braunschweig, Germany

Re: Create a fancy section heading layout?

Postby idaham on Thu Jun 19, 2008 10:03 am

idaham wrote:[...] Although, the section number is too small (\Huge here), and when I try to change it to something bigger, using ex. \fontsize it doesn't work! I've also tried to change the font of the section number (number only, not the section title!), without any success... Should I write those commands somewhere around where I added the \color command? [...]

Just replace the \Huge command in your definition of the section format by the following sequence, which works fine for me.
Code: Select all
\fontsize{36}{42}\selectfont

As you can see, you only have forgotten the \selectfont command to activate the new font size. The second argument of the \fontsize command is the interlinear space and should have about additional 20% of the first value.[/quote]

Hello again Thorsten and thanks for all your help!
I've tried your suggestion with \fontsize{36}{42}\selectfont, which works fine. The problem is that I want an even bigger size, say 100 or something. The size doesn't seem to get any larger than 40. The weird thing is that this command is the same as the one defined in quotchap.sty:
Code: Select all
\usefont{T1}{\@defaultcnfont}{b}{n}\fontsize{150}{130}\selectfont%
    \color{chaptergrey}

which makes the chapter number very large! Apparently this size is defined... How come is doesn't work for my section number?
idaham
 
Posts: 19
Joined: Wed May 21, 2008 3:30 pm

Re: Create a fancy section heading layout?

Postby Stefan_K on Thu Jun 19, 2008 12:38 pm

Hi Ida,

try the fix-cm package:
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage{fix-cm}
\begin{document}
\fontsize{100}{120}\selectfont Huge text
\end{document}

Stefan
LaTeX Community Moderator
TeXblog.net
Stefan_K
Site Moderator
 
Posts: 2408
Joined: Mon Mar 10, 2008 8:44 pm
Location: Hamburg, Germany

Re: Create a fancy section heading layout?

Postby idaham on Thu Jun 19, 2008 3:03 pm

Stefan_K wrote:Hi Ida,

try the fix-cm package:
Code: Select all
\documentclass[a4paper,10pt]{article}
\usepackage{fix-cm}
\begin{document}
\fontsize{100}{120}\selectfont Huge text
\end{document}

Stefan


Stefan, you're a lifesaver!
This worked perfectly! I don't know how long I've been trying to get it to work without succeeding... Thank you so much! Cheers,
Ida

PS. If anyone is interested in this section style, here's the code for my sty-file:
Code: Select all
\RequirePackage[calcwidth]{titlesec}
\RequirePackage{color}
\usepackage{fix-cm}

\definecolor{seccol}{rgb}{0,0.8,0.3} % This is a kind of greenish color... you can define the exact color you want here!
\titleformat{\section}[hang]{\sffamily\bfseries}{
\fontsize{100}{100}\selectfont\color{seccol}\thesection}{0pt}{\linebreak\huge\raggedleft}[{\titlerule[0.5pt]}]
idaham
 
Posts: 19
Joined: Wed May 21, 2008 3:30 pm

Re: Create a fancy section heading layout?

Postby localghost on Thu Jun 19, 2008 6:04 pm

You should get the desired result with any postscript font, too. Just try some font packages from the CTAN Catalogue.
¹ I'm sorry. My responses are limited. You must ask the right questions.
² A minimal working example (MWE) promises quick help.
³ OS, LaTeX-System, Editor: openSUSE 11.2, TeX Live 2009, TeXworks 0.3 | Windows XP (SP3), MiKTeX 2.8, TeXworks 0.3
User avatar
localghost
Site Moderator
 
Posts: 3567
Joined: Fri Feb 02, 2007 11:06 am
Location: Braunschweig, Germany


Return to General

Who is online

Users browsing this forum: No registered users and 6 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group