+ "li.david" <***@seed.net.tw>:
| Dear all,
|
| I write
|
| \section{Color TV \hfill 1 set}
|
| \hfill works. But I like to underline it as below.
|
| \section{\underline{Color TV \hfill 1 set}}
|
| \hfill does not work? What is the problem and how to solve?
Bluntly put, the problem is that you're trying to do the wrong thing,
and LaTeX makes it hard to do the wrong thing sometimes.
In more detail, \underline typesets first, then underlines the
result. At the end you have an underlined box with no flexibility,
hence no ability to stretch across the line.
If you really really wish to do this thing, the right way is to
redefine the \section command to do it the way you wish. There are a
number of packages around to help with this kind of redefinitions, but
I am not the right person to tell you which one you need. (I tend to
work closer to the metal than most LaTeX users, so I am relatively
ignorant of what the right package can do.)
Anyway, if you wish to underline a line of text, with an \hfill inside
it so it stretches to fill the entire line, something like this will
work:
\noindent\underline{\makebox[\textwidth][s]{Color TV \hfill 1 set}}
It's harder if you wish to underline only part of the line, and that
part contains the \hfill. You have to compute the appropriate width
of that part, then use it in place of \textwidth in the above example.
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
than thinking does: but it deprives us of whatever chance there is
of getting closer to the truth. -- C.P. Snow