Skip to content

Using \linewidth instead when converting img/table to latex #9775

Closed
@zwz

Description

@zwz

Describe your proposed improvement and the problem it solves.
When converting img/table with percentage width (in html) to latex, pandoc uses \textwidth or \columnwidth now, like

\includegraphics[width=0.4908\textwidth]{test.png}
\begin{longtable}[]{@{}
  >{\centering\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3333}}
  >{\centering\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3333}}
  >{\centering\arraybackslash}p{(\columnwidth - 4\tabcolsep) * \real{0.3333}}@{}}
...

It works perfect for most cases.
But when the img/table is in enumerate environment with items indented, it stretches out at the left side,
makes the text in the environment not so fluent and beautiful.

I googled and according to

  1. https://tex.stackexchange.com/questions/16942/difference-between-textwidth-linewidth-and-hsize
  2. https://tex.stackexchange.com/questions/124323/tabularx-within-the-enumerate-environment
  3. https://tex.stackexchange.com/questions/250662/width-of-minipages-inside-enumerate-environments

it seems a good idea to use \linewidth instead.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions