I use the command include{}
to import .tex files from other sources, and in one of them is used a tabularx
environment. While my main/base .tex file, which is where the other .tex's are imported into, uses the command linespread{2.0}
in its preamble, which functions with no doubt, only the lines in tabularx
are unaffected. No matter where I add \newcommand\linespread{2.0}
again, the lines in tabularx are kept in 1.0 linespread. How can I change the linespread in the tabularx
into 2.0?
1 Answer
Using David Carlisle's comment you get a line spacing of 2 with
\usepackage[doublespacing]{setspace}
for text\renewcommand\baselinestretch{2}\selectfont
insidetable
environment
Code:
\documentclass{article}
\usepackage{lipsum}
\usepackage{tabularx}
\usepackage[doublespacing]{setspace}
\begin{document}
\lipsum[1]
\begin{table}[h]
\centering
\renewcommand\baselinestretch{2}\selectfont
\caption{example table}
\begin{tabularx}{10cm}{|X|X|}
\hline
foo & bar\\ \hline
foobar & foo\\ \hline
\end{tabularx}
\end{table}
\lipsum[2]
\end{document}
Result:
\documentclass{...}
and ending with\end{document}
.\include
isn't related to this and probably nottabularx
either. Floats such as thetable
environment call\normalsize
which will reset the line spacing. Normally you should set\baselinestretch
or use a package such assetspace
rather than use\linespread