How To Make Width of An Inner Table Use Full Column Width of An Outer Table?

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

tabularx - How to make width of an inner table use full column width o...

http://tex.stackexchange.com/questions/151246/how-to-make-width-of...

sign up

log in

tour

help

TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How to make width of an inner table use full column width of an outer table?
When making tabularx one need to give a table width. For the outermost table, one can use \textwidth . When making one or more inner table(s) inside outer table(s), the inner table(s) also need a width, which will be in this case the width of the column of the outer table that this inner table happened to be in. It is hard to keep track of the the context and to manually give hardcoded values. I am not able to figure how to tell LaTeX to use all the available column width from the outer table, and let LaTeX do the calculation. Need something similar to X but for the tablewidth itself. Here is a MWE one one table inside another.
\documentclass[10pt,notitlepage]{article}% \usepackage{tabularx} \usepackage{hyperref} \usepackage{array} \newcolumntype{Y}{>{\centering\arraybackslash}X} \begin{document} %have to use tabular* for outer table since I can't figure how to use tabularx \begin{tabular*}{\textwidth}{|p{0.5\textwidth}|p{0.5\textwidth}|}\hline \begin{tabularx}{0.5\textwidth}{@{}|Y|Y|Y|@{}}\hline % how to automate this? % instead of 0.5\textwidth % use full column width

\href{foo/index.htm}{A} \begin{enumerate} \item item 1 \item item 2 \end{enumerate}& \href{foo/index.htm}{B}& \href{foo/index.htm}{C}\\\hline \end{tabularx} & second column \end{tabular*} \end{document}

{ tables} { tabularx} edited 2 hours ago Svend Tveskg


6,724 2 7 47

asked 3 hours ago Nasser


1,428 1 12

1 Answer
You can use \linewidth . Useful reference will be: this Q and its A. It would be better to use p{\dimexpr0.5\textwidth2\tabcolsep\relax} for the outer table and a left aligned cell structure for enumerate .

1 of 2

12/25/2013 12:55 PM

tabularx - How to make width of an inner table use full column width o...

http://tex.stackexchange.com/questions/151246/how-to-make-width-of...

\documentclass[10pt,notitlepage]{article}% \usepackage{tabularx} \usepackage{hyperref} \usepackage{array} \newcolumntype{Y}{>{\centering\arraybackslash}X} \begin{document} %have to use tabular* for outer table since I can't figure how to use tabularx \noindent\begin{tabular*}{\textwidth}{|p{\dimexpr0.5\textwidth2\tabcolsep\relax}| @{\extracolsep{\fill}}p{\dimexpr0.5\textwidth2\tabcolsep \relax}|}\hline \begin{tabularx}{\linewidth}{@{}|p{0.35\hsize}|Y|Y|@{}}\hline % how to automate this? % instead of 0.5\textwidth % use full column width {\centering \href{foo/index.htm}{A}\par} \begin{enumerate} \item item 1 \item item 2 \end{enumerate} & \href{foo/index.htm}{B}& \href{foo/index.htm}{C}\\\hline \end{tabularx} & second column \end{tabular*} \end{document}

edited 2 hours ago

answered 3 hours ago Harish Kumar


46.7k 2 56 125

There are other improvisations possible, but I am not sure of what is your final goal. Harish Kumar 3 hours ago

2 of 2

12/25/2013 12:55 PM

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy