Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question is related to How to create a newcommand for fontsize?. I would like to change the fontsize within \ul of the soul package. For example:

\newcommand{\mycfs}[1]{\fontsize{#1pt}{1.2#1pt}\selectfont} 
\soulregister{\mycfs}{1}

\ul{{\mycfs{6} Size 6 font} Normal size font}

This error message occurs: ! Package soul Error: Reconstruction failed.

How can this be fixed?

share|improve this question
    
Have a look at the correction and additional answers to the other topic. –  Stefan Kottwitz Aug 23 '10 at 19:00
add comment

2 Answers 2

I would change the definition of \mycfs so that it no longer has an argument:

\documentclass{book}
\usepackage{soul}

\newcommand\mycfs{\fontsize{\mysize}{\the\dimexpr \mysize*1.2\relax}\selectfont}
\newcommand\mysetsize[1]{\edef\mysize{#1pt}}
\soulregister{\mycfs}{0}

\begin{document}
\mysetsize{6}

\ul{\mycfs Size 6 font} Normal size font
\end{document}
share|improve this answer
add comment

\mbox could already fix it for you:

\documentclass{book}
\usepackage{soul}
\newlength{\mysize}
\newcommand{\mycfs}[1]{\setlength{\mysize}{#1pt}%
  \fontsize{\mysize}{1.2\mysize}\selectfont}
\begin{document}
text

\ul{\mbox{\mycfs{6}Size 6 font} Normal size font}

text
\end{document}

Output:

alt text

share|improve this answer
1  
The trouble with mbox is that is will not line break properly and out out of the margin. –  user942 Aug 23 '10 at 21:16
    
What is the goal? Underlining long passages or several lines seems strange to me. –  Stefan Kottwitz Aug 23 '10 at 21:22
1  
underlining urls –  user942 Aug 23 '10 at 21:23
2  
As underlining is typographically questionable style it's rarely used in texts, even modern webpages try to avoid that. It's a relic of the time of early browsers. So, it's not well supported. Perhaps have a look at tex.ac.uk/cgi-bin/texfaq2html?label=underline - maybe you might find a better emphasizing of URLs than underlining? Bold, colored, or typewriter font? –  Stefan Kottwitz Aug 23 '10 at 21:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.