mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-29 01:41:20 +08:00
Use \linewidth instead of \columnwidth or \textwidth...
for resizing figures, table cells, etc. in LaTeX. `\linewidth`, unlike the others, is sensitive to indented environments like lists. Closes #9775.
This commit is contained in:
@@ -1068,7 +1068,7 @@ inlineToLaTeX (Image attr@(_,_,kvs) _ (source, _)) = do
|
||||
Just (Percent a) ->
|
||||
[d <> literal (showFl (a / 100)) <>
|
||||
case dir of
|
||||
Width -> "\\textwidth"
|
||||
Width -> "\\linewidth"
|
||||
Height -> "\\textheight"
|
||||
]
|
||||
Just dim ->
|
||||
@@ -1076,7 +1076,7 @@ inlineToLaTeX (Image attr@(_,_,kvs) _ (source, _)) = do
|
||||
Nothing ->
|
||||
case dir of
|
||||
Width | isJust (dimension Height attr) ->
|
||||
[d <> "\\textwidth"]
|
||||
[d <> "\\linewidth"]
|
||||
Height | isJust (dimension Width attr) ->
|
||||
[d <> "\\textheight"]
|
||||
_ -> []
|
||||
|
||||
@@ -149,7 +149,7 @@ colDescriptors isSimpleTable
|
||||
toColDescriptor :: Int -> Alignment -> Double -> Text
|
||||
toColDescriptor numcols align width =
|
||||
T.pack $ printf
|
||||
">{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.4f}}"
|
||||
">{%s\\arraybackslash}p{(\\linewidth - %d\\tabcolsep) * \\real{%0.4f}}"
|
||||
(T.unpack (alignCommand align))
|
||||
((numcols - 1) * 2)
|
||||
width
|
||||
@@ -391,7 +391,7 @@ multicolumnDescriptor isSimpleTable
|
||||
(T.unpack (colAlign align))
|
||||
(if colnum + colspan >= numcols then skipColSep else "")
|
||||
|
||||
else printf "%s>{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.4f} + %d\\tabcolsep}%s"
|
||||
else printf "%s>{%s\\arraybackslash}p{(\\linewidth - %d\\tabcolsep) * \\real{%0.4f} + %d\\tabcolsep}%s"
|
||||
(if colnum == 0 then skipColSep else "")
|
||||
(T.unpack (alignCommand align))
|
||||
(2 * (numcols - 1))
|
||||
|
||||
@@ -235,7 +235,7 @@ wrapDiv (_,classes,kvs) t = do
|
||||
w = maybe "0.48" fromPct (lookup "width" kvs)
|
||||
in inCmd "begin" "column" <>
|
||||
valign <>
|
||||
braces (literal w <> "\\textwidth")
|
||||
braces (literal w <> "\\linewidth")
|
||||
$$ contents
|
||||
$$ inCmd "end" "column"
|
||||
else id
|
||||
|
||||
@@ -57,7 +57,7 @@ ok
|
||||
\begin{frame}{Slide one}
|
||||
\phantomsection\label{slide-one}
|
||||
\begin{columns}[T]
|
||||
\begin{column}{0.4\textwidth}
|
||||
\begin{column}{0.4\linewidth}
|
||||
\begin{itemize}
|
||||
\tightlist
|
||||
\item
|
||||
@@ -67,7 +67,7 @@ ok
|
||||
\end{itemize}
|
||||
\end{column}
|
||||
|
||||
\begin{column}{0.4\textwidth}
|
||||
\begin{column}{0.4\linewidth}
|
||||
\begin{itemize}
|
||||
\tightlist
|
||||
\item
|
||||
@@ -77,7 +77,7 @@ ok
|
||||
\end{itemize}
|
||||
\end{column}
|
||||
|
||||
\begin{column}{0.1\textwidth}
|
||||
\begin{column}{0.1\linewidth}
|
||||
ok
|
||||
\end{column}
|
||||
\end{columns}
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
% pandoc -fmarkdown-implicit_figures -t latex
|
||||
{height=2em}
|
||||
^D
|
||||
\includegraphics[width=\textwidth,height=2em]{lalune.jpg}
|
||||
\includegraphics[width=\linewidth,height=2em]{lalune.jpg}
|
||||
```
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
\begin{frame}{Level 2 blocks}
|
||||
\phantomsection\label{level-2-blocks}
|
||||
\begin{columns}[T]
|
||||
\begin{column}{0.4\textwidth}
|
||||
\begin{column}{0.4\linewidth}
|
||||
\begin{block}{Block one}
|
||||
\phantomsection\label{block-one}
|
||||
\begin{itemize}
|
||||
@@ -27,7 +27,7 @@
|
||||
\end{block}
|
||||
\end{column}
|
||||
|
||||
\begin{column}{0.6\textwidth}
|
||||
\begin{column}{0.6\linewidth}
|
||||
\begin{block}{Block two}
|
||||
\phantomsection\label{block-two}
|
||||
\begin{itemize}
|
||||
|
||||
@@ -14,11 +14,11 @@ content2
|
||||
\begin{frame}{title}
|
||||
\phantomsection\label{title}
|
||||
\begin{columns}[T]
|
||||
\begin{column}{0.08\textwidth}
|
||||
\begin{column}{0.08\linewidth}
|
||||
content
|
||||
\end{column}
|
||||
|
||||
\begin{column}{0.84\textwidth}
|
||||
\begin{column}{0.84\linewidth}
|
||||
content2
|
||||
\end{column}
|
||||
\end{columns}
|
||||
|
||||
@@ -19,18 +19,18 @@
|
||||
^D
|
||||
\begin{frame}
|
||||
\begin{columns}[T]
|
||||
\begin{column}[c]{0.48\textwidth}
|
||||
\begin{column}[c]{0.48\linewidth}
|
||||
\end{column}
|
||||
|
||||
\begin{column}[b]{0.48\textwidth}
|
||||
\begin{column}[b]{0.48\linewidth}
|
||||
\end{column}
|
||||
\end{columns}
|
||||
|
||||
\begin{columns}[b,onlytextwidth]
|
||||
\begin{column}[T]{0.48\textwidth}
|
||||
\begin{column}[T]{0.48\linewidth}
|
||||
\end{column}
|
||||
|
||||
\begin{column}[t]{0.48\textwidth}
|
||||
\begin{column}[t]{0.48\linewidth}
|
||||
\end{column}
|
||||
\end{columns}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ dolly[^5]
|
||||
hello\footnote{doc footnote}
|
||||
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{0.1667}}@{}}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 0\tabcolsep) * \real{0.1667}}@{}}
|
||||
\caption[Sample table.]{Sample table.\footnote{caption footnote}}\tabularnewline
|
||||
\toprule\noalign{}
|
||||
\begin{minipage}[b]{\linewidth}\centering
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
\begin{frame}{One-A}
|
||||
\begin{columns}[T]
|
||||
\begin{column}{0.48\textwidth}
|
||||
\begin{column}{0.48\linewidth}
|
||||
\begin{itemize}
|
||||
\tightlist
|
||||
\item
|
||||
@@ -46,7 +46,7 @@
|
||||
\end{itemize}
|
||||
\end{column}
|
||||
|
||||
\begin{column}{0.48\textwidth}
|
||||
\begin{column}{0.48\linewidth}
|
||||
\begin{itemize}
|
||||
\tightlist
|
||||
\item
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</table>
|
||||
^D
|
||||
\begin{longtable}[]{@{}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{1.0000}}@{}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 0\tabcolsep) * \real{1.0000}}@{}}
|
||||
\toprule\noalign{}
|
||||
\endhead
|
||||
\bottomrule\noalign{}
|
||||
|
||||
+12
-12
@@ -53,10 +53,10 @@ Right & Left & Center & Default \\
|
||||
Multiline table with caption:
|
||||
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1375}}
|
||||
>{\raggedleft\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1625}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.3500}}@{}}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1375}}
|
||||
>{\raggedleft\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1625}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3500}}@{}}
|
||||
\caption{Here's the caption. It may span multiple lines.}\tabularnewline
|
||||
\toprule\noalign{}
|
||||
\begin{minipage}[b]{\linewidth}\centering
|
||||
@@ -91,10 +91,10 @@ Second & row & 5.0 & Here's another one. Note the blank line between rows. \\
|
||||
Multiline table without caption:
|
||||
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1375}}
|
||||
>{\raggedleft\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1625}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.3500}}@{}}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1375}}
|
||||
>{\raggedleft\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1625}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3500}}@{}}
|
||||
\toprule\noalign{}
|
||||
\begin{minipage}[b]{\linewidth}\centering
|
||||
Centered Header
|
||||
@@ -128,10 +128,10 @@ Table without column headers:
|
||||
Multiline table without column headers:
|
||||
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1375}}
|
||||
>{\raggedleft\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.1625}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.3500}}@{}}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1500}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1375}}
|
||||
>{\raggedleft\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1625}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3500}}@{}}
|
||||
\toprule\noalign{}
|
||||
\endhead
|
||||
\bottomrule\noalign{}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
\begin{longtable}[]{@{}
|
||||
>{\centering\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.3000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.3000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.2000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 6\tabcolsep) * \real{0.2000}}@{}}
|
||||
>{\centering\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3000}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3000}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2000}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2000}}@{}}
|
||||
\caption[Nordic countries]{States belonging to the
|
||||
\emph{Nordics.}}\label{nordics}\tabularnewline
|
||||
\toprule\noalign{}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
\begin{longtable}[]{@{}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{0.5000}}
|
||||
>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{0.5000}}@{}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.5000}}
|
||||
>{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.5000}}@{}}
|
||||
\caption{List of Students}\label{students}\tabularnewline
|
||||
\toprule\noalign{}
|
||||
\begin{minipage}[b]{\linewidth}\centering
|
||||
@@ -20,15 +20,15 @@ Name
|
||||
\endhead
|
||||
\bottomrule\noalign{}
|
||||
\endlastfoot
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
Computer Science} \\
|
||||
3741255 & Jones, Martha \\
|
||||
4077830 & Pierce, Benjamin \\
|
||||
5151701 & Kirk, James \\
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
Russian Literature} \\
|
||||
3971244 & Nim, Victor \\
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
Astrophysics} \\
|
||||
4100332 & Petrov, Alexandra \\
|
||||
4100332 & Toyota, Hiroko \\
|
||||
|
||||
Reference in New Issue
Block a user