I have a piece of code that I want to integrate into my tex document. I have used \verbatiminput to include the code into my document, but I would like to put it in a box and use figure caption to explain it. How could I do this? Does the figure caption number would follows other figure caption created by \begin{fgure}?
Note that I use kile.
Cheers,
Carol
Graphics, Figures & Tables ⇒ putting code in a box with figure caption
NEW: TikZ book now 40% off at Amazon.com for a short time.

putting code in a box with figure caption
Use the listings package
Re: putting code in a box with figure caption
How about if it is not a code but the output of a program or just a text file?
Moreover, the captions of the listing are independent of floats. I want the opposite that the captions of these pieces would follow floats' caption.
Also, note that there are some lines that exceed the width of the page so they should be adjusted
Any suggestions?
Moreover, the captions of the listing are independent of floats. I want the opposite that the captions of these pieces would follow floats' caption.
Also, note that there are some lines that exceed the width of the page so they should be adjusted
Any suggestions?
putting code in a box with figure caption
No problem for the listing packagecarol wrote:How about if it is not a code but the output of a program or just a text file?
I don't really understand what you mean. If you're saying that the listing package uses his own counter and name for the captions, you can easily adjust it (its explained in the documentation of the listing package)carol wrote:Moreover, the captions of the listing are independent of floats. I want the opposite that the captions of these pieces would follow floats' caption.
Automatic line breaking is an option of the listing package, as explained in the documentation of the packagecarol wrote:Also, note that there are some lines that exceed the width of the page so they should be adjusted
Re: putting code in a box with figure caption
Hi Robin,
Thanks for your reply. Actually, I found no information how it is possible to have the same counter for listings captions and floating caption. I have defined a command for floating captions \newcommand*\mycaption[2]{\caption[#1]{#1 #2}}, how could I use it as key value for \lstinputlisting[]?
Look forward to your reply,
carol
Thanks for your reply. Actually, I found no information how it is possible to have the same counter for listings captions and floating caption. I have defined a command for floating captions \newcommand*\mycaption[2]{\caption[#1]{#1 #2}}, how could I use it as key value for \lstinputlisting[]?
Look forward to your reply,
carol