Insert::special formatting::horizontal line

creates the latex macro \lyxline.
Unfortunately, the definition of \lyxline contains some spaces that
wreaks havoc when the line to be underlined is nicely centered with
hfills on either side. The spacing from the macro takes up extra space
in addition to the hfills, and therefore the line isn't so nicely centered
anymore.

(I know about centered paragraphs, the actual use is a bit more
complicated. But this simple use of hfills is enough to show the problem.)

Current definition:
\newcommand{\lyxline}[1]{
  {#1 \vspace{1ex} \hrule width \columnwidth \vspace{1ex}}
}

Several problems here.  First - the spacing that gets included.
Note that one can't arbitrarily pretty-indent latex code, the
indenting spacing messes up the output. One cannot arbitrarily
include linefeeds either.  But one can arbitrarily include
a linefeed for prettier code, _if_ it is preceeded by a % sign 
that makes the linefeed a comment.
Second - why the #1 parameter?  lyx just inserts \lyxline{} with no
parameter anyway.  Third - an extra set of { } in the definition.
Fixing the spacing is easier if these things are removed also.

My suggested \lyxline that works for me. I.e. I get the same output, except
that nothing screws up:

\newcommand{\lyxline}{%
\vspace{1ex} \hrule width \columnwidth \vspace{1ex}}

Helge Hafting

Reply via email to