Discussion:
Output: Right margin problem for a section* (standard font:typewriter,italic)
Joe(theWordy)Philbrook
2010-04-03 06:48:12 UTC
Permalink
If it matters:
I use whichever version of LyX is available from the repository of
whichever Linux system I'm currently using. At the moment that means:
LyX 1.6.5 on Arch Linux
------------------------
Note: I'm NOT an LaTeX wizard, nor a professional writer So if I use an
incorrect name for something... Please bear with me.
------------------------

This is a work in progress that I work on when I can. I have doubts that
it'll ever get "published" but just in case, I want to keep the output
presentable.

I'm using book (more font sizes) with base size set to 14 so that my eyes
are capable of reading a printed document. I also have roman set to bookman.
Every thing else in document settings are the default values that were
originally set by LyX 1.5.x... But there are some ERT boxes inserted here
and there...

Now the problem:

If I understand correctly a "leftside page" normally gets a larger righthand
margin to leave room for binding the pages together. Which is fine with me.
But I have a short section* (about a page and a half with an 8.5" x 11"
page size and a base size of 14) that I wanted typeset just a little bit
differently to set it apart from the other text. I don't consider it
verse, and it's certainly not a quote of someone else's words. So I left
the environment set to standard but set the font to typewriter italic. At
this point I should mention that none of the ERT boxes I've inserted are
supposed to change margin settings. However when I view the output with DVI
or PDF, the righthand margin of this short section allows some of the lines
to get within about an quarter of an inch of the right hand edge of the
"paper". And that's on the leftside page, there is a line on the
rightside page that actually bleeds off the paper...

I can compensate for this by redefining the environment as verse
where the rightside pages righthand margin stays about the same as that of
the leftside page.

I get similar, but slightly better results from setting the environment to
quotation. Like verse, the righthand margin appears the same for both the
leftside and rightside pages. But with quotation it's slightly better
because the closest it gets to the righthand edge of the "paper" is
approximately doubled to a half inch or so... But it's still not right.
And besides, Like I said, I don't want it formatted as verse. And I'm not
quoting anyone...

I've extracted the problematic section into a much smaller document that
includes the preamble, all applicable ERT boxes and a few dummy sections
and chapters to ensure the output formatting of the problem section
remains the same, etc... I will attempt to attach the resulting .lyx file
to this message. So someone smarter than me could maybe tell me what I'm
doing wrong. But I can't remember if attachments make it to this list via
gmane's usenet mirror. We shall see... ;-7
--
| ~^~ ~^~
| <?> <?> Joe (theWordy) Philbrook
| ^ J(tWdy)P
| \___/ <<jtwdyp-***@public.gmane.org>>
Paul A. Rubin
2010-04-03 14:16:09 UTC
Permalink
Seems to be a "quirk" of LaTeX specific to typewriter font. Since
typewriter font is intended to have fixed spacing, LaTeX can't justify
things evenly. There's a fix at
http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2005-09/msg00004.html
that works on your document if you don't mind variable spacing between
words. Another possibility is to make that section of text left
justified (ragged right) rather than fully justified. Under other
circumstance a third option would be to use the hyphenat package to
allow hyphenation of typewriter text. Unfortunately, that would require
a change to your prose style -- you're not using long enough words in
that section. :-) (I tested this -- hyphenation did not cure the problem.)

/Paul
Steve Litt
2010-04-03 16:59:33 UTC
Permalink
Post by Joe(theWordy)Philbrook
I get similar, but slightly better results from setting the environment to
quotation. Like verse, the righthand margin appears the same for both the
leftside and rightside pages. But with quotation it's slightly better
because the closest it gets to the righthand edge of the "paper" is
approximately doubled to a half inch or so... But it's still not right.
And besides, Like I said, I don't want it formatted as verse. And I'm not
quoting anyone...
I'd like to frame the preceding paragraph and send it to everyone I know. In a
world where most people jam in codes everywhere, you actually try to make your
styles represent the intent of the writing.

There's an easy answer to your problem, and I'll tell it to you in another
email.

StevET

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt
Steve Litt
2010-04-03 17:16:59 UTC
Permalink
Post by Joe(theWordy)Philbrook
I get similar, but slightly better results from setting the environment to
quotation. Like verse, the righthand margin appears the same for both the
leftside and rightside pages. But with quotation it's slightly better
because the closest it gets to the righthand edge of the "paper" is
approximately doubled to a half inch or so... But it's still not right.
And besides, Like I said, I don't want it formatted as verse. And I'm not
quoting anyone...
Hi Joe,

What you want is the MEANING of "Joe's special paragraph" but a LOOK similar
to the standard quotation environment. So do something like this in a layout
file:

=================================================
Preamble
\newenvironment{joesspecialparagraphL}
{
\begin{quotation}
% Add any tweaks you want here
}{
% Add any ending tweaks you want here
\end{quotation}
}
EndPreamble


Style JoesSpecialParagraph
CopyStyle Quotation
LatexType Environment
LatexName joesspecialparagraphL
End
=================================================

The part where I discuss tweaks is where you modify the look of the quotation
environment to match your desired look. So you'd put margin changes, font
changes, and any decorations (boxes, shaded boxes or whatever) in the tweak
areas.

I highly recommend you separate the LaTeX code (the stuff between the Preamble
and EndPreamble from the LyX code (the stuff between "Style" and "End"). LyX
allows you to stick a Preamble/EndPreamble pair right in the LyX style, and a
lot of people recommend that, but under certain arcane conditions reusable
code can break in a non-obvious way when you do that. I always put my LaTeX in
the upper part of my layout file and the LyX code in the lower part so I don't
have these problems.

As far as how to make a layout file, I have a bunch of documentation on the
subject here:

http://www.troubleshooters.com/linux/lyx/index.htm

SteveT

Steve Litt
Recession Relief Package
http://www.recession-relief.US
Twitter: http://www.twitter.com/stevelitt
Joe(theWordy)Philbrook
2010-04-03 21:20:33 UTC
Permalink
Seems to be a "quirk" of LaTeX specific to typewriter font. Since typewriter
font is intended to have fixed spacing, LaTeX can't justify things evenly.
There's a fix at
http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2005-09/msg00004.html
that works on your document if you don't mind variable spacing between words.
Another possibility is to make that section of text left justified (ragged
right) rather than fully justified. Under other circumstance a third option
would be to use the hyphenat package to allow hyphenation of typewriter text.
Unfortunately, that would require a change to your prose style -- you're not
using long enough words in that section. :-) (I tested this -- hyphenation
did not cure the problem.)
Thank you for the link, and the suggestion on left justification. I'll
have to experiment...

However what I don't understand why, whether LaTeX can properly
justify typewriter font or not, surely such a powerful typesetting
system could detect that the line was going to exceed the intended
margin, and at least adjust "word wrap" to move the offending word
down to the next line. (of course then the next line would have to be
readjusted, then the next ad infinum...) It would still fail true
justification, but at least the text would remain inside the margins.

And if there is a reason I don't understand, why, LaTeX can't do this,
Then perhaps LyX itself {could/should?} in the spirit of letting it's
users focus on content, detect the known problem and make the
evidently complex coding adjustments necessary to alter the right
margin {I gather with LaTeX this is controlled by line length settings,
which I don't think a LyX user should need to know how to override in
such a way that the override only affects the typewriter font
paragraph(s)}

However both the preceding paragraphs project my idealistic concept of
what LyX/LaTeX should do to keep it's user base concentrating on
content, rather than any belief that either idea will ever come into
play. So I'm curious, would there maybe be something I could put in an
ert box that saves the current line length settings some place that I
could restore them from after I then used some more LyX code to simply
reduce the line length of the affected portion(s) of a document?

One other thought, even if LyX can't be expected to 'automatically'
compensate for this LaTeX "quirk" is it feasible that a line length
element could someday be added to LyX's paragraph settings???
Post by Joe(theWordy)Philbrook
I get similar, but slightly better results from setting the environment to
quotation. Like verse, the righthand margin appears the same for both the
leftside and rightside pages. But with quotation it's slightly better
because the closest it gets to the righthand edge of the "paper" is
approximately doubled to a half inch or so... But it's still not right.
And besides, Like I said, I don't want it formatted as verse. And I'm not
quoting anyone...
I'd like to frame the preceding paragraph and send it to everyone I know. In a
world where most people jam in codes everywhere, you actually try to make your
styles represent the intent of the writing.
Well it's not that I'm against inserting codes whenever I need a down
and dirty fix for something. But rather it's a combination of not
having taken a course in typesetting with LaTeX, having difficulty
remembering the things I have learned (I blame that on CRS), and last
but certainly not least, the fact that I'm sold on the idea of letting
my document processor (LyX) free me from micro-managing the details
of my document(s) appearance so that I can concentrate on the content.
That last point was why I chose to try to learn to use LyX about 6
years ago, even though I already realized that for me the learning curve
would be painfully slow. But if you think it would help encourage
style based solutions, please feel free to copy, modify, and publish
any or all of my post with the sole exception of the copyrighted text
embedded in the example attachment.

- - - - - - - - -< snip/glue/snip >- - - - - - - - - -
What you want is the MEANING of "Joe's special paragraph" but a LOOK similar
to the standard quotation environment. So do something like this in a layout
=================================================
Preamble
\newenvironment{joesspecialparagraphL}
{
\begin{quotation}
% Add any tweaks you want here
}{
% Add any ending tweaks you want here
\end{quotation}
}
EndPreamble
Style JoesSpecialParagraph
CopyStyle Quotation
LatexType Environment
LatexName joesspecialparagraphL
End
=================================================
The part where I discuss tweaks is where you modify the look of the quotation
environment to match your desired look. So you'd put margin changes, font
changes, and any decorations (boxes, shaded boxes or whatever) in the tweak
areas.
((Thanks for the troubleshooters link BTW)) The above "JoesSpecialParagraph"
style idea is an interesting concept. Lets see if I'm understanding it
properly... ;)

1) By putting something like the above in my document's layout file, I'd
actually be adding an "environment" to my document that would then
actually appear as a choice in the pull-down selection list I get with
"<Alt>+p {space}" ????

2) the reason for using "CopyStyle Quotation" is that in
this particular case, the quotation style should require the fewest
"tweaks" to get the results I'm looking for. But that I could just
as easily start with any existing environment so that if I wanted
two slightly different "JoesSpecialParagraph" styles I'd be able to
(after first doing the above) then repeat the process using

=> Style JoesOtherParagraph
=> CopyStyle JoesSpecialParagraph

And only need to "tweak" the difference between the two new styles
rather than all the differences between 'quotation' and the 2nd new
style???

In which case, could you tell me how I might effectively increase the
right hand margin, as one of these tweaks? It seems to me that if I
did that as part of an environment "style", then I could restore
the default right margin simply by changing the style back to
standard or whatever...
I highly recommend you separate the LaTeX code (the stuff between the Preamble
and EndPreamble from the LyX code (the stuff between "Style" and "End"). LyX
allows you to stick a Preamble/EndPreamble pair right in the LyX style, and a
lot of people recommend that, but under certain arcane conditions reusable
code can break in a non-obvious way when you do that. I always put my LaTeX in
the upper part of my layout file and the LyX code in the lower part so I don't
have these problems.
I gather the other method is regarded as easier or more convenient,
but you feel your method is more reliable... Out of curiosity does
their method offer any functional advantage aside from simplifying the
process of "coding" a "style" as one cohesive segment rather than two
separate but inter-dependent chunks of code?

If theirs doesn't then I think I'd just as soon learn yours. Speaking
of which, Am I right in guessing that the two lines above, that start
with an "%" could be actually included (or not) in the actual code
without affecting the results because they would be ignored as
"comments" by LyX and/or latex??? the same way a bash script ignores
lines starting with "#" ?
--
| ~^~ ~^~
| <?> <?> Joe (theWordy) Philbrook
| ^ J(tWdy)P
| \___/ <<jtwdyp-***@public.gmane.org>>

I'm NOT clueless... But I just don't know.
Paul Rubin
2010-04-03 22:09:29 UTC
Permalink
Post by Joe(theWordy)Philbrook
However what I don't understand why, whether LaTeX can properly
justify typewriter font or not, surely such a powerful typesetting
system could detect that the line was going to exceed the intended
margin, and at least adjust "word wrap" to move the offending word
down to the next line. (of course then the next line would have to be
readjusted, then the next ad infinum...) It would still fail true
justification, but at least the text would remain inside the margins.
LaTeX has internal algorithms to measure the "badness" of a block of text,
and it makes spacing and line-wrapping decisions to minimize badness given
some constraints. Violating a margin is allowed with some penalties; putting
large amounts of space between words is allowed with some penalties. Under
most circumstance, hyphenation is allowed with some penalties. In your
case, there were apparently places where violating the margin was "cheaper".

I suspect that a TeXpert could find and adjust the weights assigned to
various forms of typographical malfeasance such that you'd be very unlikely
to get a margin violation. (That's beyond my level of expertise.) I also
suspect that if you did that, it would end up either looking like a ragged
right paragraph (if you used small violations for short lines and somewhat
large violations for chasms between words) or the first solution I mentioned
(ERT to adjust inter-word spacing) if you continued to enforce justification
and allowed funky inter-word spacing. Your comment about moving the offending
word is essentially the latter case.
Post by Joe(theWordy)Philbrook
And if there is a reason I don't understand, why, LaTeX can't do this,
I suspect the authors did not want to make the decision above (which remedy
to adopt) for you.
Post by Joe(theWordy)Philbrook
Then perhaps LyX itself {could/should?} in the spirit of letting it's
users focus on content, detect the known problem and make the
evidently complex coding adjustments necessary to alter the right
margin {I gather with LaTeX this is controlled by line length settings,
which I don't think a LyX user should need to know how to override in
such a way that the override only affects the typewriter font
paragraph(s)}
The ERT fix is not complex, just a bit obscure. I suspect one could create
a module to implement it as a LaTeX environment, although I'm not positive.
It's possible the user would need to futz with the values used in the spacing
adjustment (meaning that larger tolerances might be needed in some situations,
and smaller tolerances might produce nicer looking output in others).

/Paul

Loading...