title: How can I have Sphinx tables fit to width?
body: <p>Consider this table, where <code>pyeval</code> is a macro that evaluates an expression and replaces it with its value (so I can avoid hardcoding values in the documentation):</p>
  
  <pre><code>======================= ===========================================
  Subsytem                Default path
  ======================= ===========================================
  :pyeval:`constants.FOO` :pyeval:`pathutils.DEFAULT_FOO_STORAGE_DIR`
  :pyeval:`constants.BAR` :pyeval:`pathutils.DEFAULT_BAR_STORAGE_DIR`
  :pyeval:`constants.BAZ` :pyeval:`pathutils.DEFAULT_BAZ_STORAGE_DIR`
  ======================= ===========================================
  </code></pre>
  
  <p>This renders with this HTML:</p>
  
  <pre><code>&lt;table border="1" class="docutils"&gt;
    &lt;colgroup&gt;
      &lt;col width="40%"&gt;
      &lt;col width="60%"&gt;
    &lt;/colgroup&gt;
    &lt;thead valign="bottom"&gt;
      &lt;tr class="row-odd"&gt;
        &lt;th class="head"&gt;Subsystem&lt;/th&gt;
        &lt;th class="head"&gt;Default storage path&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody valign="top"&gt;
      &lt;tr class="row-even"&gt;
        &lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;foo&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
        &lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;/srv/badp/foo-path/&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row-odd"&gt;
        &lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;bar&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
        &lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;/srv/badp/bar-path/&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="row-even"&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;
        &lt;span class="pre"&gt;baz&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
        &lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;/var/run/badp/baz-path/&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Because of the macro, the amount of width I have to give to the <code>Subsytem</code> column is only slightly smaller than the column <code>Default path</code> gets, but the contents of its column are much shorter. Since Sphinx tries to be "helpful", it tries to transfer the ratio of widths in the source file to the HTML page (notice the <code>colgroup</code> tag) and the result is quite uneven:</p>
  
  <p><img src="https://i.stack.imgur.com/WN8gf.png" alt="enter image description here"></p>
  
  <p>Notice that Chrome (just like Firefox does) "helpfully" breaks at the hyphenation point and, since this is a path, I don't get to change hyphens to non breaking hyphens; people are just too likely to copy paste these values.</p>
  
  <p>If I remove the <code>colgroup</code> element, however, I get the table I want.</p>
  
  <p><img src="https://i.stack.imgur.com/u07EM.png" alt="enter image description here"></p>
  
  <p>How can I tell Sphinx to please be less smart with my table?</p>