Graphics, Figures & TablesTable Conversion, Part 1: Row Height & Positioning

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
LaTexLearner
Posts: 139
Joined: Tue Mar 10, 2015 11:06 am

Table Conversion, Part 1: Row Height & Positioning

Post by LaTexLearner »

I want to learn to convert this table that I made in MS Word 2010 into a LaTeX/TikZ table.

(Though this picture has only 3 rows, it's part of the MWE. I may need to learn efficient ways to make, say, a 15-row version of this.)
goal pic of tables.png
goal pic of tables.png (22.76 KiB) Viewed 2715 times


The first issue I have is with row height and positioning of the contents of the table. This is what I have so far.

Code: Select all

\documentclass[12pt,letterpaper]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{array}
\usepackage{booktabs}
\usepackage{tabularx}

\usepackage{tikz}

\usepackage{graphicx}

\begin{document}

\begin{tabularx}{16cm}{|p{2.2cm}|p{2.5cm}|X|} \hline


\textbf{Parts Per Whole}  & \textbf{Name of Each Part} & \textbf{Number Line} \\ \hline

3 & third & 
	\begin{tikzpicture}[xscale=4][yscale=10]
	\draw (0,0)--(2,0) ; % x-axis
	\foreach \x in {0,...,6} % vertical tick marks
	\draw (\x/3,-0.3)--(\x/3,0.3); % 
	\foreach \x in {0,...,2} % whole numbers below
        \node[below] at (\x,-0.35) {\x};    
    \end{tikzpicture} \\ \hline

& & \begin{tikzpicture}[xscale=3.5]
	\draw (0,0)--(2.5,0) ;
	\foreach \x in {0,...,10}
	\draw (\x/4,-0.3)--(\x/4,0.3);
	\foreach \x in {0,1,2}
        \node[below] at (\x,-0.35) {\x};    
    \end{tikzpicture} \\ \hline

& & \begin{tikzpicture}[xscale=2.1]
	\draw (0,0)--(4.2,0) ;
	\foreach \x in {0,...,21}
	\draw (\x/5,-0.3)--(\x/5,0.3);
	\foreach \x in {0,...,4}
        \node[below] at (\x,-0.35) {\x};    
    \end{tikzpicture} \\ \hline

\end{tabularx}

\end{document}

What is the easiest way for me to say, get a row height of exactly 3.5cm and then place text and TikZ pictures left/center/right and bottom/middle/top inside those 3.5cm rows?

Also, in the top row, why is there more space below the text than above it?

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply