Ok, so I'm working with a sphinx-generated latex document and I'm trying to fix some of the rather ugly code - and generated output. I've got a table that doesn't split when it gets to the end of the page, but this wouldn't be a problem if I could give the table rows a max-height (similar to the way varwidth can be used to set a max-width for columns), if they would collapse the excess height. All the rows have a fair amount of excess space. Below is part of the table, and an image of it. Not looking for an answer, necessarily, but for any ideas of applicable features. I apologize if this is too general to get an answer.

\unskip}\relax &\sphinxstylethead{\relax 
\unskip}\relax &\sphinxstylethead{\relax 
\unskip}\relax \\
the transmission factor
computed by the equation above
the gain through the transmitting antenna for the main beam path
{\hyperref[\detokenize{docs/sensors_and_signatures_ag:ag-sensors-and-signatures-antenna-pattern}]{\sphinxcrossref{\DUrole{std,std-ref}{Transmitter's Antenna Pattern}}}}
the gain through the transmitting antenna for the reflecting beam path
{\hyperref[\detokenize{docs/sensors_and_signatures_ag:ag-sensors-and-signatures-antenna-pattern}]{\sphinxcrossref{\DUrole{std,std-ref}{Transmitter's Antenna Pattern}}}}

Image of excess row-height

Here are the packages included by sphinx.

\fi \sphinxpxdimen=49336sp\relax
% Include hyperref last.
% Fix anchor placement for figures with captions.
\usepackage{hypcap}% it must be loaded after hyperref.
% Set up styles of URL: it should be placed after hyperref.
  • Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. We0re missing the L column definition – Moriambar Jun 19 '17 at 18:46
  • LOL. @Moriambar: I cannot provide a min working example: as I said above, this is Sphinx-generated code and it is hideous. The document is a monster. I would never write it this way and having a difficult time interpreting the parts I need to fix. :) I added the included packages, above, but I assumed that the 'L' column definition was just the standard 'left-align'. I didn't seen anything more explicit. – tonip Jun 19 '17 at 19:10
  • @DavidCarlisle: See above for why the equations are written this way. Varwidth allows you to set a max - but defaults to less, if it doesn't need it. I would wish to set a max height of 3 or 4 lines, with the intent that it would collapse to the height of 1 or 2 for most of them. – tonip Jun 19 '17 at 19:10
  • yes but varwidth is all about setting the width for linebreaking so it is natural to have a parameter to control the maximumn, tabulary is also about controlling widths for line breaking and also has parameters to control the max and min width (\TYmax and \TYmin) but neither varwidth nor tabulary do anything at all about the height of anything, so I can not guess what you would want the parameter to do. – David Carlisle Jun 19 '17 at 19:13
  • @DavidCarlisle: I'm sorry, I thought I said what I wanted it to do, but I can see how I may have couched it in restrictive terms. I cannot easily change the table type (it would have to be re-fixed every time the documentation was re-generated), but I can modify it. If you have any ideas for fixing the excess table-height - any, at all - I would appreciate it. And I'm not necessarily looking for someone to solve it for me: I just want to know if anyone knows of LaTeX features that could provide a potential solution. Any MWE I could provide - and that I was given back - would be insufficient. – tonip Jun 19 '17 at 19:15

You are using faulty reStructuredText input.

.. list-table:: Frozen Delights!
   :widths: 10 50 30

   * - :math:`F_r`
     - the receiving factor
     - computed by the equation above

   * - :math:`G_{mr}`
     - the gain through the receiving antenna for the 
       main beam path
     - :ref:`ReceiverAntenna`

   * - :math:`G_{rr}`
     - the gain through the reflecting antenna for the
       reflecting beam path
     - :ref:`ReceiverAntenna`


enter image description here

People can not test your code as it depends on the sphinx.sty package.

I recommend you spend some time reading the documentation at http://www.sphinx-doc.org. You can use the tabularcolumns directive for more control of column widths.

and also at http://docutils.sourceforge.net/docs/ref/rst/directives.html

In the above I have used the simplest input method for tables. You can also use (I recommend Emacs table mode) the "grid table", and create merged cells both horizontal and vertical allowing contents no other LaTeX package does.

Without the :widths: option one gets:

enter image description here

assuming naturally your table is not in some list or quoted, where its total width would be made shorted to accomodate the indentation of the environment.

  • +1 thanks I had a suspicion that the bad output was due to bad input but without the system or any example code I had to go with what I had:-) – David Carlisle Jun 19 '17 at 21:53
  • @DavidCarlisle you did very good detective work indeed :-) in reST there is a notion of "directives" and "roles". For inline mark-up, one uses (most of the time) "roles" such as :math:`<contents>` . The OP must have used the .. math:: directive which is for displayed math. (these mark-up are added by Sphinx via its sphinx.ext.mathjax or sphinx.ext.imgmath extensions) – user4686 Jun 19 '17 at 21:57
  • @DavidCarlisle I sense you are ready now to join Sphinx and leave LaTeX3, hence even though quite off-topic for the site I provide this link sphinx-doc.org/en/stable/ext/math.html – user4686 Jun 19 '17 at 22:09
  • @jfbu: Thank you, this definitely completes the diagnosis that David did such a good job starting. I am very grateful for all the help. The :widths: specification is useful, but not necessary. Just switching to the :math: role is sufficient to correct the row issues (I only had width problems on other table-types, and fixed those differently). – tonip Jun 20 '17 at 18:20

The extra vertical space is almost certainly due to the misuse of equation* which is a display enviornment designed to offset an equation with vertical space.

If you can not change the generated code and there are no other equations I would do


so that


gets typeset like

  • Thanks David! That's an almost-perfect solution. Unfortunately, I don't think I want to replace all equations in the document that way (I'll test and find out), but then again, perhaps I do. :) – tonip Jun 19 '17 at 19:55
  • @tonip you don't need to do those definitions for the whole document just do it in some local group before the table – David Carlisle Jun 19 '17 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.