1

The center column is defined by \picwidth. All the other columns should have the same or another size. Why is the third column shifted to the right?

\parindent=0pt
    Dies ist ein Beispiel. \vskip\baselineskip
    \hrule
    \vskip\baselineskip
    \def\text {ein Beispiel. Dies ist ein Beispiel. Ein Text, wie ihn jeder schreiben kann, aber kein Blindtext, und auch kein Text, der immer wieder herein kopiert wird. }
    \raggedright 
    \input miniltx.tex
    \input graphicx.tex
    \newdimen\picheight 
    \newdimen\picwidth 
    \newdimen\beforepicwidth 
    \newdimen\afterpicwidth 
    \newdimen\columnsep
    \columnsep=14pt
    \def\centerpic[#1,#2,#3,#4,#5]{
    \def\overpic{\vtop{\hsize\picwidth #1\vfill}}
    \def\beforepic{\vtop{\hsize\beforepicwidth #2 \vfill}\hskip\columnsep}
    \def\pic{\vtop{\overpic \vskip\baselineskip \includegraphics[width=\picwidth,keepaspectratio,]{#3}\vskip\baselineskip\underpic}\hskip\columnsep}
    \def\afterpic{\hskip-2\picwidth\vtop{\hsize\afterpicwidth #4}}
    \def\underpic{\vtop{\hsize\picwidth #5\vfill}\hskip\columnsep}
    \vtop{%
    \picheight=16pt %height of picture not needed with aspectratio%
    \picwidth=120pt %width of picture
    \beforepicwidth=\picwidth%
    \afterpicwidth=\picwidth%
    \vskip0.1\baselineskip%
    \hbox{%
    \beforepic%
    \pic%
    \afterpic%
    }}\vskip\baselineskip}%
    \centerpic[\text,\text,example-image,\text,\text]%
    \vskip\baselineskip
    \hrule
    \vskip\baselineskip
    Dies ist ein Beispiel.
    \bye

enter image description here

2
  • I changed the image so we can use the example, it looks like 4 columns to me..Is that what you saw with the original image? Commented Mar 1, 2021 at 22:05
  • @David Carlisle Thanks and yes, that is what I saw.
    – user186178
    Commented Mar 1, 2021 at 22:09

1 Answer 1

0

enter image description here

You were starting paragraphs in the vboxes so they were line breaking to \hsize.

Unrelated but you had % on lines where they were not needed and not where they are.

\parindent=0pt
    Dies ist ein Beispiel. \vskip\baselineskip
    \hrule
    \vskip\baselineskip
    \def\text {ein Beispiel. Dies ist ein Beispiel. Ein Text, wie ihn jeder schreiben kann, aber kein Blindtext, und auch kein Text, der immer wieder herein kopiert wird. }
    \raggedright 
    \input miniltx.tex
    \input graphicx.tex
    \newdimen\picheight 
    \newdimen\picwidth 
    \newdimen\beforepicwidth 
    \newdimen\afterpicwidth 
    \newdimen\columnsep
    \columnsep=14pt
    \def\centerpic[#1,#2,#3,#4,#5]{%
    \def\overpic{\vtop{\hsize\picwidth #1\vfill}}%
    \def\beforepic{\vtop{\hsize\beforepicwidth #2 \vfill}\hskip\columnsep}%
    \def\pic{\vtop{\overpic \vskip\baselineskip \hbox{\includegraphics[width=\picwidth,keepaspectratio,]{#3}}\vskip\baselineskip\underpic}\hskip\columnsep}%
    \def\afterpic{\vtop{\hsize\afterpicwidth #4}}%
    \def\underpic{\vtop{\hsize\picwidth #5\vfill}}%
    \vtop{%
    \picheight=16pt %height of picture not needed with aspectratio
    \picwidth=120pt %width of picture
    \beforepicwidth=\picwidth
    \afterpicwidth=\picwidth
    \vskip0.1\baselineskip
    \hbox{%
    \beforepic
    \pic
    \afterpic
    }}\vskip\baselineskip}%
    \centerpic[\text,\text,example-image,1\text,2\text]%
    \vskip\baselineskip
    \hrule
    \vskip\baselineskip
    Dies ist ein Beispiel.
    \bye

3
  • Thank you, works fine. The idea was, to have symetric or asymetric columns and to fill the unused space as good as possible. It's much more easier with \raggedright, without and without \hyphenation it seems to be impossible, But that will be another question.
    – user186178
    Commented Mar 1, 2021 at 23:04
  • @MatthiasBorck-Elsner ?? ragged or justified text would make no difference here. You are specifying all three widths as \picwidth but you could make them whatever width you like, such as making them + 2 \colsep add up to \hsize Commented Mar 1, 2021 at 23:52
  • Yes, in this example I had all columns defined equal. Next step may be \beforepicwidth=0.6\picwidth \afterpicwidth=0.6\picwidth or x.x\picwidth. Adding up with \hsize I did not try yet.
    – user186178
    Commented Mar 2, 2021 at 0:00

You must log in to answer this question.