How to get rid of align(horizon) additional vertical space?

align(horizon) often adds some vertical whitespace, i.e. align(center+horizon, $f=g$) is a little taller than align(center,$f=g$) For large diagrams this can be significant. Is it possible to get rid of this additional whitespace? I am trying to do align(center+horizon, stack(dir:ltr, ...)) where the objects in my stack are of varying heights, but for some reason this is significantly taller than the height of the tallest item in the stack.

Can you share a minimal example of both cases where the difference is visible?

In this code, there is a small but not really stand-out difference between the vertical positioning of the first character a.

#align(horizon,[a]) // vs just a\
#let f(x) = [#x]
#for i in array.range(50) { [#i\ ] }

If I could understand how to adapt this code so that the top of the second box was aligned with the top margin of the page, that would perhaps help me.

#stack(
  dir: ltr,
  rect(height: 40pt),
  rect(height: 120pt),
  rect(height: 90pt),
)

EDIT: I played around a little more and I have an example which is more representative of my problem, from this angle perhaps the problem is that #align does not properly account for space which is needed for the bibliography? Here is my bibliography file, tmp_refs.bib

@book{aguiarMonoidalFunctorsSpecies2010,
  title = {Monoidal Functors, Species, and {{Hopf}} Algebras},
  author = {Aguiar, Marcelo and Mahajan, Swapneel Arvind},
  date = {2010},
  series = {{{CRM}} Monograph Series / {{Centre}} de Recherches Mathématiques, {{Montréal}}},
  number = {v. 29},
  publisher = {{American Mathematical Society}},
  location = {{Providence, R.I}},
  url = {http://pi.math.cornell.edu/~maguiar/a.pdf},
  isbn = {978-0-8218-4776-3},
  pagetotal = {784},
  keywords = {Categories (Mathematics),Combinatorial analysis,Hopf algebras,Quantum groups,Symmetry groups}
}

and here is a small, if not minimal, document that shows the behavior I’m interested in:

#lorem(450)
#cite(<aguiarMonoidalFunctorsSpecies2010>)
#align(horizon,[a])
#bibliography("tmp_refs.bib")

I am not satisfied with the vertical position of this letter ‘a’. It is positioned too low, it is sitting on top of the bibliography and I would like it to be more vertically centered in the gap between the end of the main text and the bibliography.

Hello @gadget142, I have renamed your post “How to get rid of align(horizon) additional vertical space?”. You can take a look at How to post in the Questions category, we recommend that

In the first example, align introduces a parbreak which causes a bigger spacing between the a and the 0. Additionally, the align(horizon, ...) does try to align your a vertically on the page, so it pushes the page content which comes after it down as much as possible and that also produces a bit of spacing (as there is a bit of spacing between the last item on the page and the margin).

Example1
// Column 1
a\
#let f(x) = [#x]
#for i in array.range(11) { [#i\ ] }
#colbreak()

// Column 2
#align("a")
#let f(x) = [#x]
#for i in array.range(11) { [#i\ ] }
#colbreak()

// Column 3
#align(horizon, [a])
#let f(x) = [#x]
#for i in array.range(11) { [#i\ ] }

test

I don’t quite understand the problem in the second example.

In the third example I think you are looking for #v(1fr).

Example3
#lorem(500)
#v(1fr)
a
#v(1fr)
#lorem(50)

test