> But this shows an error, I want something like this, black text, gray BG > and black border. > [image: Latex.jpg] > -- > Any package or code for this?
Sorry for posting again without waiting for any answer from others. I have found out another way to do this,
*\usepackage{verbatim,framed}* *\usepackage[usenames,dvipsnames]{color}* * * *\newenvironment{colorverbatim}[1][Gray]%* *{%* *\definecolor{shadecolor}{named}{#1}%* *% supress ugly vertical space which is inserted by* *% environment above and below text:* *\topsep=0ex\relax* *% start shaded and verbatim:* *\shaded \verbatim \color{White}* *}%* *{%* *\endverbatim* *\endshaded* *}%* * * *\begin{colorverbatim}* * auto eth0* *\end{colorverbatim}* * * This environment gives me the output I want, but still black border is needed. How to do this?
On Sat, Jan 29, 2011 at 12:38 PM, Ashish Revar <ashishre...@gmail.com>wrote:
>> But this shows an error, I want something like this, black text, gray BG >> and black border. >> [image: Latex.jpg] >> -- >> Any package or code for this?
> I am trying to make verbatim text may differ from the other text. > For that, I have defined some commands like below, > \usepackage{color} > \definecolor{gray}{gray}{0.5}
Sound ok exept that i won't use a name that is also a keyword and that is meanless (as you are using grayscale, gray by it's own is a nonsense; \definecolor{gray50}{gray}{0.5} or \definecolor{halfgray}{gray}{0.5} sound better imho) My suggestion : \definecolor{BoxBackground}{gray}{0.1} % 10% \definecolor{BoxForeground}{gray}{0.9} % 90% \definecolor{BoxBorderframe}{gray}{0.8} % 80% \fcolorbox{BoxBorderframe}{BoxBackground}{ \color{BoxForeground} % the default text color (black) is not changed, we had to specify the desired one if we want something else (then no need with the default black excep if the hole is chanfed previousely) ... now comes your text :)
> But this shows an error, I want something like this, black text, gray BG and black border.
I didn't test it but maybe color package don't know the color name "white" ? I used to use those names too, but I always instruct the package that I want to use some basic/common friendly names so: \usepackage[usenames,dvipsnames]{color} % http://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_know... Please consider reading the package documentation (command line: texdoc color)
You may consider using the package Fancy Verbatim too (also read the documentation) \usepackage{fancyvrb} \usepackage{color} % don't forget to define your needed colors.. ... \colorbox{BoxBackgroud}{ % this trick is required because there's no option provided for that, but you may redefine some internals used by Verbatim if you wisth ;) \begin{Verbatim}[frame=single, fillcolor=BoxBackground, formatcom=\color{BoxForeground}] % the frame use the same color as the text, otherwise add the option rulecolor=\color{BoxBorderframe} in the list too. \end{Verbatim} % beware: "Verbatim" (capital v) instead of "verbatim"
}
Another solution.. listing package \usepackage{fancyvrb} \usepackage{color} % don't forget to define your needed colors.. ... \lstset{language=bash, backgroundcolor=\color{BoxBackgroud}, rulecolor=\color{BoxBorderframe} } \textcolor{BoxForeground}{ % use this trick if you don't want to use defautlt text color and don't have time to tweek each class ofwords/tokens used by the language ;) \begin{lstlisting}[frame=single] % put your listing here \end{lstlisting}
\begin{document} \begin{colframe} \begin{Verbatim}{frame=single} auto eth0 \end{Verbatim} \end{colframe} \end{document}
The problem with the verbatim environment is that the line \end{verbatim} * must* occur exactly as-is *in the document*, not in a macro. The verbatim package tries to overcome this restriction, but adds some of its own. The Verbatim (capital V) environment from fancyvrb still has that restriction, but has options for a frame and a lot of other bells and whistles. The fancybox package provides the Sbox environment which lets you capture material into a box which you can then frame and colour yourself as the \TheSbox.
Thank you all, But I am having report class not article.
As well as I have tried this fancyverb package but this shows error in itemize...somehow, which can't figure out, why? It prompts the error with the line that already defined or somewhat which means \item is being conflicted by using this fancyverb package in report class.
Any guess to use this in report class?
On Sat, Jan 29, 2011 at 11:56 AM, Peter Flynn <anglebrac...@gmail.com>wrote:
> The problem with the verbatim environment is that the line \end{verbatim} > *must* occur exactly as-is *in the document*, not in a macro. The verbatim > package tries to overcome this restriction, but adds some of its own. The > Verbatim (capital V) environment from fancyvrb still has that restriction, > but has options for a frame and a lot of other bells and whistles. The > fancybox package provides the Sbox environment which lets you capture > material into a box which you can then frame and colour yourself as the > \TheSbox.
> ///Peter
> -- > You received this message because you are subscribed to the Google Groups > "LaTeX Users Group" group. > To post to this group, send email to latexusersgroup@googlegroups.com. > To unsubscribe from this group, send email to > latexusersgroup+unsubscribe@googlegroups.com<latexusersgroup%2Bunsubscribe@ googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/latexusersgroup?hl=en.
-- *Thanks and Regards,* *Ashish Revar,* *Nirma University, ashishre...@gmail.com 9909298846*
On Sat, Jan 29, 2011 at 5:35 PM, Ashish Revar <ashishre...@gmail.com> wrote: > Thank you all, > But I am having report class not article.
I don't understand the problem. What I wrote works in any class. Just copy and paste it into a report.
> As well as I have tried this fancyverb package but this shows error in > itemize...somehow, which can't figure out, why?
Because I make the box too wide (.85\columnwidth). I changed it (see below) so that it automatically adapts to fit the available space (I hope). I added the calc package so it could work this out.
> It prompts the error with the line that already defined or somewhat which > means \item is being conflicted by using this fancyverb package in report > class.
Nothing to do with it.
> Any guess to use this in report class?
The error has nothing to do with the report class.
\begin{document} This is an example of using it in a report \begin{itemize} \item To make networking start on boot, type \begin{colframe} \begin{Verbatim}{frame=single} $ auto eth0 \end{Verbatim} \end{colframe} \item To get rid of a bogus \texttt{eth0} device left over from a wired connection when your wireless fires up \texttt{eth1}, type \begin{colframe} \begin{Verbatim}{frame=single} $ ifconfig eth0 down \end{Verbatim} \end{colframe} \item Happy \LaTeX ing! \end{itemize} \end{document}
For colored background and all, we are using fancyverb and others packages. If I want the same thing for itemize (Lists) or maybe for any matrix or array, then what to do?
Is there any document related to this? As I want to study the SBox and Minipage which you have coded in last reply. Can you please explain that code if possible?
On Sun, Jan 30, 2011 at 3:58 AM, Peter Flynn <anglebrac...@gmail.com> wrote: > On Sat, Jan 29, 2011 at 5:35 PM, Ashish Revar <ashishre...@gmail.com>wrote:
>> Thank you all, >> But I am having report class not article.
> I don't understand the problem. What I wrote works in any class. Just copy > and paste it into a report.
>> As well as I have tried this fancyverb package but this shows error in >> itemize...somehow, which can't figure out, why?
> Because I make the box too wide (.85\columnwidth). I changed it (see below) > so that it automatically adapts to fit the available space (I hope). I added > the calc package so it could work this out.
>> It prompts the error with the line that already defined or somewhat which >> means \item is being conflicted by using this fancyverb package in report >> class.
> Nothing to do with it.
>> Any guess to use this in report class?
> The error has nothing to do with the report class.
> }{% > \end{minipage} > \end{Sbox} > \begin{center} > \fcolorbox{black}{LightSteelBlue}{\TheSbox} > \end{center} > } > \begin{document} > This is an example of using it in a report > \begin{itemize} > \item To make networking start on boot, type > \begin{colframe} > \begin{Verbatim}{frame=single} > $ auto eth0 > \end{Verbatim} > \end{colframe} > \item To get rid of a bogus \texttt{eth0} device left over from a > wired connection when your wireless fires up \texttt{eth1}, type
> -- > You received this message because you are subscribed to the Google Groups > "LaTeX Users Group" group. > To post to this group, send email to latexusersgroup@googlegroups.com. > To unsubscribe from this group, send email to > latexusersgroup+unsubscribe@googlegroups.com<latexusersgroup%2Bunsubscribe@ googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/latexusersgroup?hl=en.
-- *Thanks and Regards,* *Ashish Revar,* *Nirma University, ashishre...@gmail.com 9909298846*
On Mon, Jan 31, 2011 at 6:19 AM, Ashish Revar <ashishre...@gmail.com> wrote: > Thanks Peter,
> For colored background and all, we are using fancyverb and others packages. > If I want the same thing for itemize (Lists) or maybe for any matrix or > array, then what to do?
The same:
\begin{colframe} \begin{itemize} \item foo \item bar \item blort \end{itemize} \end{colframe}
I finally found out the problem which was preventing my file to successful output. In our institute format textwidth was predefined using below command.
\renewcommand{\textwidth}{6in}
So, I have then commented that line and now it is working. But I want to know that, what was the problem here?
On Tue, Apr 19, 2011 at 11:01 AM, Ashish Revar <ashishre...@gmail.com>wrote:
> Solution given by Peter was working fine in my previous report. But this > time I am using this with my final report it making some conflicts. Below > are the packages which I have used in report.
> \documentclass[12pt,a4paper]{report}
> \usepackage[pdftex]{graphicx} > \DeclareGraphicsExtensions{.pdf,.jpeg,.png} > \usepackage{amsthm,amssymb} % for mathematical formulas > \usepackage{rotating} %used to have landskape figures > \usepackage{graphicx} > \usepackage{enumerate} > \usepackage{epsfig}
> %\usepackage{algorithms} > %\usepackage{algorithm} > %\usepackage{algorithmic} > \usepackage{pseudocode} > %\usepackage{fancybox} > %\usepackage{mathpazo} %for good font
> \usepackage{subfigure} > %\usepackage{slashbox} > \usepackage{pict2e} > \usepackage{makeidx} > %\usepackage{subfig} > \usepackage{multirow} > \usepackage{nomencl} > % to have links to figures and citations in PDF version. > \usepackage{hyperref} > \usepackage{setspace}
> I have another tex file which is included like this way... > \flushbottom > \include{ProposedArch} > \flushbottom
> which contains the code like it... > \begin{Verbatim}{frame=single} > $ ifconfig eth0 down > \end{Verbatim} > \end{colframe}
> but it shows the error, > ! Missing number, treated as zero. > <to be read again> > \let > 1.5 \begin{colframe} > ?
> What is the problem? Which packages are being crashed with each other? I > have no idea, I have done minimal examples.
> On Mon, Jan 31, 2011 at 4:15 PM, Peter Flynn <anglebrac...@gmail.com>wrote:
>> On Mon, Jan 31, 2011 at 6:19 AM, Ashish Revar <ashishre...@gmail.com>wrote:
>>> Thanks Peter,
>>> For colored background and all, we are using fancyverb and others >>> packages. If I want the same thing for itemize (Lists) or maybe for any >>> matrix or array, then what to do?
>> -- >> You received this message because you are subscribed to the Google Groups >> "LaTeX Users Group" group. >> To post to this group, send email to latexusersgroup@googlegroups.com. >> To unsubscribe from this group, send email to >> latexusersgroup+unsubscribe@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/latexusersgroup?hl=en.
Solution given by Peter was working fine in my previous report. But this time I am using this with my final report it making some conflicts. Below are the packages which I have used in report.
\documentclass[12pt,a4paper]{report}
\usepackage[pdftex]{graphicx} \DeclareGraphicsExtensions{.pdf,.jpeg,.png} \usepackage{amsthm,amssymb} % for mathematical formulas \usepackage{rotating} %used to have landskape figures \usepackage{graphicx} \usepackage{enumerate} \usepackage{epsfig}
%\usepackage{algorithms} %\usepackage{algorithm} %\usepackage{algorithmic} \usepackage{pseudocode} %\usepackage{fancybox} %\usepackage{mathpazo} %for good font
\usepackage{subfigure} %\usepackage{slashbox} \usepackage{pict2e} \usepackage{makeidx} %\usepackage{subfig} \usepackage{multirow} \usepackage{nomencl} % to have links to figures and citations in PDF version. \usepackage{hyperref} \usepackage{setspace}
On Mon, Jan 31, 2011 at 4:15 PM, Peter Flynn <anglebrac...@gmail.com> wrote: > On Mon, Jan 31, 2011 at 6:19 AM, Ashish Revar <ashishre...@gmail.com>wrote:
>> Thanks Peter,
>> For colored background and all, we are using fancyverb and others >> packages. If I want the same thing for itemize (Lists) or maybe for any >> matrix or array, then what to do?
> -- > You received this message because you are subscribed to the Google Groups > "LaTeX Users Group" group. > To post to this group, send email to latexusersgroup@googlegroups.com. > To unsubscribe from this group, send email to > latexusersgroup+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/latexusersgroup?hl=en.