LyXCreating a table with vertical centered text

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
Bepob
Posts: 2
Joined: Tue Jan 06, 2015 3:33 pm

Creating a table with vertical centered text

Post by Bepob »

Hi folks,

I've created a table that contains multiple combined rows. The problem is that I want to align the contant so that it is vertically centered in each row. But it doesn't seem to work if I choose the option "align center". I tried to adjust for that by altering the offset value, but that doesn't look that nice if the combined row is created of a large set of rows. Any ideas on how to improve that table?

Thanks a lot!

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Creating a table with vertical centered text

Post by Johannes_B »

rosspost to the german forum GoLaTeX.

Please read, what our administrator thinks about that: Gimme Pizza


The thing is, with the amount of information given, the question is not answerable. We need an example to test, called a minimal lyx example. As there are almost no LyX supporters here, i suggest to export the code to LaTeX. Your chance of help is much higher that way. Elke already asked you for more information in form of a minimal example in the german forum.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Bepob
Posts: 2
Joined: Tue Jan 06, 2015 3:33 pm

Creating a table with vertical centered text

Post by Bepob »

Thank you. I've created a minimal lyx example.
See cell "a" to get a grasp of what I'm speaking about. Due to the long lines of "lorem ipsum" with 15 words some of the words break into the next line. This causes the text in cell "a" to be misplaced from a veritically aligned perspective. Is there a way to fix this?

Code: Select all

%% LyX 2.1.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{multirow}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{setspace}

\makeatother

\usepackage{babel}
\begin{document}
\begin{spacing}{0.8}

\begin{tabular}{>{\centering}p{1cm}>{\centering}p{4cm}}
\multicolumn{2}{c}{{\tiny{}A}}\tabularnewline
\hline 
\multirow{23}{1cm}{{\tiny{}a}} & \multirow{4}{4cm}{{\tiny{}Lorem ipsum dolor sit amet}}\tabularnewline
 & \tabularnewline
 & \tabularnewline
 & \tabularnewline
\cline{2-2} 
 & {\tiny{}Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed
diam nonumy eirmod tempor invidunt ut}\tabularnewline
\cline{2-2} 
 & {\tiny{}Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed
diam nonumy eirmod tempor invidunt ut}\tabularnewline
\cline{2-2} 
 & {\tiny{}Lorem ipsum dolor sit amet}\tabularnewline
\cline{2-2} 
 & {\tiny{}Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed
diam nonumy eirmod tempor invidunt ut}\tabularnewline
\cline{2-2} 
 & {\tiny{}Lorem ipsum dolor sit amet}\tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\cline{2-2} 
 & \tabularnewline
\hline 
\end{tabular}

\end{spacing}
\end{document}
Post Reply