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.
LyX ⇒ Program listing inside table cell
NEW: TikZ book now 40% off at Amazon.com for a short time.

Program listing inside table cell
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.
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}
Re: Program listing inside table cell
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.
I thought there would be a way for doing this simple thing into Lyx.
Re: Program listing inside table cell
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.

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.

-
- Site Moderator
- Posts: 542
- Joined: Sat Sep 01, 2012 6:38 am
Re: Program listing inside table cell
Thanks for posting back the solution you found!