4

I want to print this text :
make -j 5 KDEB_PKGVERSION=1.yourcustomname deb-pkg

But I feel because of the underscore , LaTeX generates an error missing $ inserted and it doesn't print it as well.

Secondly, In the \fbox{} , I wanted to print the two texts on the next line(i.e) one text per line , so I used \ and even \par but it doesn't seem to work and I would like to align the (or) as well.

 \fbox{\texttt{uname -a}\\(or) \texttt{cat /proc/version}}

Here is my full source code:

\documentclass[12pt]{article}
\author{Subham Soni S.}
\date{\today}
\title{Compiling and Installing a Kernel 3.13.3 On Ubuntu, Debian and its Derivatives}
\begin{document}
\maketitle
To replace the existing \textsl{kernel} with a new one, do the following:
\begin{enumerate}
\item Create a folder named \emph{kernel} in the home directory.
\item Download the latest kernel to the folder from  \texttt{www.kernel.org}.
\item Extract the file.
\item In the terminal, type the following command to \textbf{install the neccesary tools to compile the kernel}:
  \begin{center}
    \fbox{\texttt{sudo apt-get install gcc libncurses5-dev dpkg-dev}}
  \end{center}
\item Enter the directory of the extracted kernel source
  \begin{center}
    \fbox{\texttt{cd kernel} \par \texttt{cd linux-3.13.3}}
  \end{center}
\item Configure the kernel
  \begin{center}
    \fbox{\texttt{make menuconfig}}
  \end{center}
  In this menu you can customize your kernel
\item Save and exit
\item Compile the kernel
  \begin{center}
    \fbox{\texttt{make -j 5 KDEB_PKGVERSION=1.yourcustomname deb-pkg}}
  \end{center}
  \emph{This process might take a while...}
\item Install the kernel
  \begin{center}
    \fbox{\texttt{sudo dpkg -i ../linux*.deb}}
  \end{center}
\item Reboot
  \begin{center}
    \fbox{\texttt{sudo reboot}}
  \end{center}
\item Run the following commands to check the kernel version
  \begin{center}
    \fbox{\texttt{uname -a}\\(or) \texttt{cat /proc/version}}
  \end{center}
\item You can easily uninstall the kernel with the command:
  \begin{center}
    \fbox{\texttt{sudo apt-get purge linux-image-3.13.3 linux-image-3.13.3-dbg}}
  \end{center}
\end{enumerate}
\end{document}
subham soni
  • 9,673
  • You can try adding \usepackage{newverbs} and inputting the command lines as \fverb!do_something! – egreg Feb 21 '14 at 09:40

3 Answers3

4

The problem is in the row 28, word KDEB_PKGVERSION. If you write KDEB\_PKGVERSION file works.

\documentclass[12pt]{article}
\author{Subham Soni S.}
\date{\today}
\title{Compiling and Installing a Kernel 3.13.3 On Ubuntu, Debian and its Derivatives}
\begin{document}
\maketitle
To replace the existing \textsl{kernel} with a new one, do the following:
\begin{enumerate}
\item Create a folder named \emph{kernel} in the home directory.
\item Download the latest kernel to the folder from  \texttt{www.kernel.org}.
\item Extract the file.
\item In the terminal, type the following command to \textbf{install the neccesary tools to compile the kernel}:
  \begin{center}
    \fbox{\texttt{sudo apt-get install gcc libncurses5-dev dpkg-dev}}
  \end{center}
\item Enter the directory of the extracted kernel source
  \begin{center}
    \fbox{\texttt{cd kernel} \par \texttt{cd linux-3.13.3}}
  \end{center}
\item Configure the kernel
  \begin{center}
    \fbox{\texttt{make menuconfig}}
  \end{center}
  In this menu you can customize your kernel
\item Save and exit
\item Compile the kernel
  \begin{center}
    \fbox{\texttt{make -j 5 KDEB\_PKGVERSION=1.yourcustomname deb-pkg}}
  \end{center}
  \emph{This process might take a while...}
\item Install the kernel
  \begin{center}
    \fbox{\texttt{sudo dpkg -i ../linux*.deb}}
  \end{center}
\item Reboot
  \begin{center}
    \fbox{\texttt{sudo reboot}}
  \end{center}
\item Run the following commands to check the kernel version
  \begin{center}
    \fbox{\texttt{uname -a}}\par
    or \fbox{\texttt{cat /proc/version}}
  \end{center}
\item You can easily uninstall the kernel with the command:
  \begin{center}
    \fbox{\texttt{sudo apt-get purge linux-image-3.13.3 linux-image-3.13.3-dbg}}
  \end{center}
\end{enumerate}
\end{document}

EDIT:

with the comand

\fbox{\texttt{uname -a}}\par
or \fbox{\texttt{cat /proc/version}}

you have two lines in two box

marchetto
  • 991
4

Let us be colorful with tcolorbox:

\documentclass{article}
\usepackage{listings}
\lstdefinestyle{mystyle}{%
    basicstyle=\small\ttfamily,
    breaklines=true,
    columns=fullflexible,
}%

\usepackage{tcolorbox}
\tcbuselibrary{most}
\newtcblisting{session}{%
      width=\linewidth,
      arc=3pt,
      top=-2mm,
      bottom=-2mm,
      left=0mm,
      right=0mm,
      boxsep=1mm,
      boxrule=1pt,
      colback=blue!20!green!20!white,
      listing only,
      listing options={style=mystyle},
      breakable,
}%

\begin{document}

\author{Subham Soni S.}
\date{\today}
\title{Compiling and Installing a Kernel 3.13.3 On Ubuntu, Debian and its Derivatives}
\maketitle

To replace the existing \textsl{kernel} with a new one, do the following:
\begin{enumerate}
\item Create a folder named \emph{kernel} in the home directory.

\item Download the latest kernel to the folder from  \texttt{www.kernel.org}.

\item Extract the file.

\item In the terminal, type the following command to \textbf{install the necessary
tools to compile the kernel}:
\begin{session}
sudo apt-get install gcc libncurses5-dev dpkg-dev
\end{session}

\item Enter the directory of the extracted kernel source
\begin{session}
cd kernel
cd linux-3.13.3
\end{session}

\item Configure the kernel
\begin{session}
make menuconfig
\end{session}
In this menu you can customize your kernel

\item Save and exit

\item Compile the kernel
\begin{session}
make -j 5 KDEB_PKGVERSION=1.yourcustomname deb-pkg
\end{session}
\emph{This process might take a while \dots}

\item Install the kernel
\begin{session}
sudo dpkg -i ../linux*.deb
\end{session}

\item Reboot
\begin{session}
sudo reboot
\end{session}

\item Run the following commands to check the kernel version
\begin{session}
uname -a
cat /proc/version
\end{session}

\item You can easily uninstall the kernel with the command:
\begin{session}
sudo apt-get purge linux-image-3.13.3 linux-image-3.13.3-dbg
\end{session}
\end{enumerate}
\end{document}

enter image description here

3

You can try with fancyvrb that also allows for friendlier input:

\documentclass{article}

\usepackage{fancyvrb}
\DefineVerbatimEnvironment{session}{Verbatim}{frame=single,fontsize=\small}

\begin{document}

\author{Subham Soni S.}
\date{\today}
\title{Compiling and Installing a Kernel 3.13.3 On Ubuntu, Debian and its Derivatives}
\maketitle

To replace the existing \textsl{kernel} with a new one, do the following:
\begin{enumerate}
\item Create a folder named \emph{kernel} in the home directory.

\item Download the latest kernel to the folder from  \texttt{www.kernel.org}.

\item Extract the file.

\item In the terminal, type the following command to \textbf{install the necessary
tools to compile the kernel}:
\begin{session}
sudo apt-get install gcc libncurses5-dev dpkg-dev
\end{session}

\item Enter the directory of the extracted kernel source
\begin{session}
cd kernel
cd linux-3.13.3
\end{session}

\item Configure the kernel
\begin{session}
make menuconfig
\end{session}
In this menu you can customize your kernel

\item Save and exit

\item Compile the kernel
\begin{session}
make -j 5 KDEB_PKGVERSION=1.yourcustomname deb-pkg
\end{session}
\emph{This process might take a while \dots}

\item Install the kernel
\begin{session}
sudo dpkg -i ../linux*.deb
\end{session}

\item Reboot
\begin{session}
sudo reboot
\end{session}

\item Run the following commands to check the kernel version
\begin{session}
uname -a
cat /proc/version
\end{session}

\item You can easily uninstall the kernel with the command:
\begin{session}
sudo apt-get purge linux-image-3.13.3 linux-image-3.13.3-dbg
\end{session}
\end{enumerate}
\end{document}

Here's a partial picture:

enter image description here

egreg
  • 1,121,712