sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.66k stars 98 forks source link

Support vbox[width=...] #367

Open simoncozens opened 8 years ago

simoncozens commented 8 years ago

First \vbox should put a box into the typesetter's queue. Second, this should make two columns:

  \begin[papersize=a5]{document}
  \script[src=packages/lorem]
  \hbox{\vbox[width=60pt]{Text here will wrap \lorem}}
  \hbox{\vbox[width=60pt]{Text here will wrap \lorem}}
  \par
  \script{SILE.typesetter:debugState()}
  \end{document}
alerque commented 8 years ago

Won't this need to introduce some alignment parameters too? Sort of like display: inline-block in CSS? Or `\begin{minipage]| in TeX. If I'm understanding this correctly the same layout logic would also be useful for image positioning.

simoncozens commented 8 years ago

Not really. The idea is that you put a vbox onto the horizontal list (which is supported but the output routine doesn't quite work).

Consider the following piece of plain TeX:

hello
\qquad \vbox to 20pt {\hbox to 40pt{Stuff in a}\hbox to 25pt{vbox}}
\qquad \vbox to 20pt {\hbox to 40pt{Stuff in a}\hbox to 25pt{vbox}}
\qquad world.
\end

screen shot 2016-09-05 at 16 11 55

(This is, essentially, how minipage is implemented under the hood.)