LyXProgram listing inside table cell

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
madtyn
Posts: 3
Joined: Thu Jun 06, 2013 10:12 am

Program listing inside table cell

Post by madtyn »

Hello,

I'm trying to insert some Java and SQL code into a Lyx document. My desire is adding some lines in order to make some kind of neat textbox around the code.

I'm doing this by making a single-cell table and inserting the code inside it as a program listing.

My problem is that when the code is too large, it doesn't fit inside the box. Apart from this, the justify options and the paragrapah don't work as expected (I'd like to put the code more on the left, but it seems impossible).

Please help.

Recommended reading 2024:

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

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

tom
Posts: 73
Joined: Thu Apr 18, 2013 4:02 am

Program listing inside table cell

Post by tom »

Hi!

If I understand you correctly, you are placing a listings environment inside a table cell. I wouldn't do that unless it's for a specific reason. Instead, listings provides the necessary functionality itself. Just take a look at its documentation.

Code: Select all

Code, edit and compile here:
\documentclass[11pt]{article}
\usepackage{listings}
%\lstset{frameround=tttt} % round corners
\begin{document}
\begin{lstlisting}[frame=single]
Put your code here.
\end{lstlisting}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
madtyn
Posts: 3
Joined: Thu Jun 06, 2013 10:12 am

Re: Program listing inside table cell

Post by madtyn »

But in Lyx I'm forced to put LaTeX code for this?

I thought there would be a way for doing this simple thing into Lyx.
madtyn
Posts: 3
Joined: Thu Jun 06, 2013 10:12 am

Re: Program listing inside table cell

Post by madtyn »

Hello,

sorry for being so late in my final answering. I have finally looked at the docs and I have some kind of solution in Lyx by using the "Configuration" contextual option on the Listings in Lyx.

In the "advanced" tab you can insert:

frame = single
linewidth = 10cm

which is the same as using the lstset{option=value} you told me. I haven't found an easy option for automatic adjusting for the box size.

I can put as well the frameround=tttt and the other things I've discovered at documentation.


Thank you for your help. Docs have helped indeed.
:)
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

Re: Program listing inside table cell

Post by scottkosty »

Thanks for posting back the solution you found!
Post Reply