LyXProblem with a table...

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
sim0ne
Posts: 11
Joined: Wed Dec 23, 2015 12:29 pm

Problem with a table...

Post by sim0ne »

Hi.

I try to creat a table, that has 2 columns. the left one has a picture in it, the right one has a few lines in it.
Image
now, i insert a picture in the left column, and add text to the lines in the right column.
Image

now, there is no line breaks in the table, even though i have spaces between the words.
and the table has the height of the text, like there wouldn't even be a picture. so the picture is completely out of place. look for yourself:
Image

what am i supposed to do to get the table i want ?

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

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Problem with a table...

Post by mas »

You should post what you have done so that it is easier for others to help you. What is expected is a Infominimal working example.

The tabular options like c/l/r do not break the lines. Use p instead. If you want more control on the alignments, use the package array. Take a look the code snippet. It might help you.

Code: Select all

\documentclass{standalone}

\usepackage{graphicx}
\usepackage{array}
\usepackage{blindtext}

\usepackage{blindtext}

\begin{document}
  \begin{tabular}{cm{.5\textwidth}}
      \includegraphics*[scale=.2]{example-image-a.png} &
      \blindtext
  \end{tabular}
\end{document}
test.png
test.png (46.67 KiB) Viewed 6867 times

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim
sim0ne
Posts: 11
Joined: Wed Dec 23, 2015 12:29 pm

Problem with a table...

Post by sim0ne »

ok, as i see, it works on your system, and it works on mine, too, using blindtext or anything of the like.
could you maybe replace the blindtext with the following, and see if it still works? because for me, it doesn't.
5.92 (dd, 4H, 3J=7.9 Hz, 4J=0.8 Hz, H-1), 6.65 (dd, 4H, 3J=7.5 Hz, 4J=1.5 Hz, H-7), 6.86 (dd, 4H, 3J=7.5 Hz, 4J=1.3 Hz, H-8), 6.87 (dd, 4H, 3J=5.8 Hz, 4J=1.5 Hz, H-5), 7.60 (dd, 4H, 3J=7.7 Hz, 4J=1.3 Hz, H-6), 7.84 (dd, 4H, 3J=7.7 Hz, 4J=1.5 Hz, H-9), 7.98 (d, 4H, 3J=7.9 Hz, H-2), 9.30 (ddd, 4H, 3J=5.8 Hz, 4J=1.5 Hz, 5J=0.8 Hz, H-4).
thanks.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Problem with a table...

Post by Johannes_B »

You can do something like this;

Code: Select all

\documentclass{article}

\usepackage{graphicx}
\usepackage{array}
\usepackage{blindtext}

\usepackage{showframe}

\begin{document}
\noindent
\begin{tabular}{>{\centering}m{.45\textwidth}m{.45\textwidth}}
	\includegraphics[width=.7\linewidth]{example-image-a.png} &
%	\blindtext
	5.92 (dd, 4H, 3J=7.9 Hz, 4J=0.8 Hz, H-1), 6.65 (dd, 4H, 3J=7.5 Hz, 4J=1.5 Hz, H-7), 6.86 (dd, 4H, 3J=7.5 Hz, 4J=1.3 Hz, H-8), 6.87 (dd, 4H, 3J=5.8 Hz, 4J=1.5 Hz, H-5), 7.60 (dd, 4H, 3J=7.7 Hz, 4J=1.3 Hz, H-6), 7.84 (dd, 4H, 3J=7.7 Hz, 4J=1.5 Hz, H-9), 7.98 (d, 4H, 3J=7.9 Hz, H-2), 9.30 (ddd, 4H, 3J=5.8 Hz, 4J=1.5 Hz, 5J=0.8 Hz, H-4).
\end{tabular}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
sim0ne
Posts: 11
Joined: Wed Dec 23, 2015 12:29 pm

Problem with a table...

Post by sim0ne »

so far, my table looks like this:

Code: Select all

\begin{tabular}{ll}
\multirow{3}{*}{\includegraphics[scale=0.4]{\string"image\string".eps}} & 
\textbf{\textsuperscript{\textbf{1}}H-NMR:} \textgreek{d} {[}ppm{]}
(500 MHz, CDCl\textsubscript{3}): \textgreek{d} 8.50 (1H, s, H-3),
7.86 (2H, d, \textsuperscript{3}J=8.2 Hz, H-9), 7.60 (1H, d, \textsuperscript{3}J=8
Hz, H-6), 7.53 (1H, dd, \textsuperscript{3}J=8.1 Hz, \textsuperscript{4}J=2.3
Hz, H-7), 7.26 (2H, d, \textsuperscript{3}J=7.9 Hz, H-10), 2.40 (3H,
s, H-12), 2.36 (3H, s, H-1).\tabularnewline
 & 13C\tabularnewline
 & ESI\tabularnewline
\end{tabular}
now, i'm don't understand latex enough to see where the difference is, which makes it impossible to get a line break. is it the tabularnewline tag ?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Problem with a table...

Post by Johannes_B »

A snipet with unknown commands once more. :-(

The thing is, lyX is not a tool to save yourself from learning LaTeX. It is a tool for people familiar with LaTeX that know what pushing a button does.

I wasn't able to compile the current example due to unknown commands, and as there are more than 5000 packages that possibly define a commands, my mood in searching the right one today is quite low.

Hint: Package chemmcaros provides commands that help when dealing with NMR stuff. Of course, this needs a bit of LaTeX knowledge and LyX will not provide a button to klick. LyX can, by definition, not provide any aspect that packages provide. This is a limitation and a safe harbour at the very same time.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Problem with a table...

Post by scottkosty »

Johannes_B wrote:A snipet with unknown commands once more. :-(

The thing is, lyX is not a tool to save yourself from learning LaTeX. It is a tool for people familiar with LaTeX that know what pushing a button does.
+1

Yes, please provide a minimal example. Please read the following:
wiki.lyx.org/FAQ/MinimalExample
sim0ne
Posts: 11
Joined: Wed Dec 23, 2015 12:29 pm

Re: Problem with a table...

Post by sim0ne »

I understand that knowing what LyX is doing is better than not knowing it.
But since I have to get my work finished, and MS Office pretty much sucks for writing long documents, I have no other choice than trying my best with LyX. I'll try to understand what to do to make it work. But in case you have an idea how I could fix it, please let me know. I appreciate it a lot !
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Problem with a table...

Post by Johannes_B »

We want to help, but we need something compilable. If not, we have to invest a lot of time. Since you are not the only one seeking help ... you have to invest a bit of time to start with.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
sim0ne
Posts: 11
Joined: Wed Dec 23, 2015 12:29 pm

Problem with a table...

Post by sim0ne »

ok, sorry. i stripped it down to just the table.
here's the complete tex-file. let's see if it works now:

Code: Select all

\documentclass[12pt,ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\setlength{\parskip}{\smallskipamount}
\setlength{\parindent}{0pt}
\usepackage{float}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{setspace}
\onehalfspacing

\makeatletter

\providecommand{\tabularnewline}{\\}

\makeatother

\usepackage{babel}
\begin{document}
\begin{tabular}{ll}
\multirow{3}{*}{\includegraphics[scale=0.4]{\string"/picture\string".eps}} & 8.50 (1H, s, H-3), 7.86 (2H, d, \textsuperscript{3}J=8.2 Hz, H-9),
7.60 (1H, d, \textsuperscript{3}J=8 Hz, H-6), 7.53 (1H, dd, \textsuperscript{3}J=8.1
Hz, \textsuperscript{4}J=2.3 Hz, H-7), 7.26 (2H, d, \textsuperscript{3}J=7.9
Hz, H-10), 2.40 (3H, s, H-12), 2.36 (3H, s, H-1).\tabularnewline
 & second row\tabularnewline
 & third row\tabularnewline
\end{tabular}
\end{document}
Post Reply