Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line disappears #479

Closed
ralsina opened this issue Jul 6, 2017 · 8 comments · Fixed by #1766
Closed

Line disappears #479

ralsina opened this issue Jul 6, 2017 · 8 comments · Fixed by #1766
Assignees
Labels
bug Software bug issue question Ask for advice or investigate solutions
Milestone

Comments

@ralsina
Copy link

ralsina commented Jul 6, 2017

\begin[class=book]{document}
        \set[parameter=document.parskip,value=12pt]
        \set[parameter=document.parindent,value=0pt]
        \font[family=DejaVu Sans,size=10pt]{

\skip[height=0pt]\glue[width=0em]This is a second line block.\glue[width=0mm plus 100%fw]\break
% \glue[width=0em]\glue[width=0mm plus 100%fw]\break
\glue[width=0em]Blank lines are permitted internally, but they must begin with a "|".\glue[width=0mm plus 100%fw]\break

fooofoo

}\end{document}

If you uncomment the commented line, the line saying "Blank lines are permitted internally" disappears from the output PDF.

@alerque
Copy link
Member

alerque commented Jul 19, 2017

Manually ending every line with a stretchable glue is not a good way to achieve left justification. That's part of what's throwing you off here. You should either use the raggedright environment or set the document.rskip value manually. This achieves roughly the same thing as your manually placed glue but tells SILE a lot more about when to use it and when it can be discarded. In your case one of those glues actually needs to be discarded but it can't the way you've put them in.

Likewise if you want space at the start of a line you should probably be setting document.skip instead of stuffing glues in there. There are exceptions of course, but you'll get a lot fewer unexpected results if you don't try to do things manually that have other mechanisms with the edge cases worked out.

@alerque
Copy link
Member

alerque commented Jul 19, 2017

I messed around with this a little bit. The actual bug here can be boiled down to just this code:

\begin{document}
\raggedright{
Line 1\break
\break
Line 2
}
\end{document}

Using break on an otherwise blank like eats the next line.

That should probably be fixed. That being said, I suspect you're really looking for a different tool. The \break function should be used sparingly. You probably want to use paragraphs in most cases and setup your paragraph spacing to do what you want it to do. A blank like between two lines of text is usually indicative of a paragraph break, so use the tool that was meant for that job.

Additional notes on your code...it's best not to include extra whitespace such as indenting the \set commands at the top of your document. Putting those at the start of the line will help keep the output queue from getting cluttered up with things that it will probably discard. Also note the \font command can be used to set the current typesetter's font without having to wrap the content in the tag. This is probably preferable in the case of setting the document's default font.

@ralsina
Copy link
Author

ralsina commented Jul 19, 2017

In his specific case it's a special sort of paragraph where line breaks and initial indents on each line are to be respected. It's what the definition asks for, so it's what has to be done to be compliant, so just setting it to raggedright would do totally the wrong thing, because it leaves control of line breaks to sile.

@ralsina
Copy link
Author

ralsina commented Jul 19, 2017

Sadly, I am sort of convinced that sile is just too buggy for real use at this point, and tables seem to just not work, so I may have to freeze my project for a while.

@simoncozens
Copy link
Member

Sounds like what you want is verbatim. But sure, with tables not working this might not be the right project for you at this time.

@ralsina
Copy link
Author

ralsina commented Jul 21, 2017

Yes, a lot like verbatim, except that it's not monospaced and there are some minor corner cases.

@alerque alerque added the question Ask for advice or investigate solutions label Feb 15, 2023
@Omikhleia Omikhleia self-assigned this Apr 2, 2023
@Omikhleia Omikhleia added the bug Software bug issue label Apr 8, 2023
@Omikhleia
Copy link
Member

Omikhleia commented Apr 8, 2023

First, let's go for a simpler MWE:

\begin[papersize=a6]{document}
\neverindent
\nofolios
Line1\break
\break
Line2

Line1\break
\glue[width=1cm]\break
Line2

Line1\break
\kern[width=1cm]\break
Line2

\end{document}

Current output consists in "Line1" paragraphs only = every thing else including "Line2" disappeared.

The code responsible for that disappearance is here:

if seenHbox == 0 then break end

It this form, it can be traced back to ad4addc from Feb 21, 2014 (< SILE 0.9.0), or possibly even earlier, but at least that commit shows a removed comment that might have explained what was intended here:

XXX TeX would toss initial line glue. We don't, because we'll often put it back again. Instead we ignore it when we call the output routine. This may not be correct.

Whatever it was supposed to do, it doesn't lead to the expected result, so indeed this is a bug.

Removing that line leads to, in each case:

  • A blank line <-- EDIT or that might have been the intent here, looking at ad4addc's log ("fix the blank line issue ..."). Dunno, but more likely than "glue tossing".
  • The "Line2" line

@Omikhleia Omikhleia added this to the v0.14.9 milestone Apr 8, 2023
@Omikhleia
Copy link
Member

Omikhleia commented Apr 8, 2023

Additionally, due to the condition setting seenHbox, this is also the offending code that caused info boxes after an empty line to disappear in #1707 and it explains why adding an empty hbox in #1751 worked...

Omikhleia added a commit to Omikhleia/resilient-types that referenced this issue Apr 8, 2023
Omikhleia added a commit to Omikhleia/resilient-types that referenced this issue Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Software bug issue question Ask for advice or investigate solutions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants