The following ten characters have special meanings in (La)TeX:
&
%
$
#
_
{
}
~
^
\
Outside \verb
, the first seven of them can be typeset by prepending a backslash; for the other three, use the macros \textasciitilde
, \textasciicircum
, and \textbackslash
.
\documentclass{article}
\begin{document}
\& \% \$ \# \_ \{ \}
\textasciitilde
\textasciicircum
\textbackslash
\end{document}
![enter image description here](https://i.stack.imgur.com/x0cQa.jpg)
Note that the seven "single non-letter" macros don't gobble the space following them.
For the last three that do gobble up the space after them you can try one of these methods to add space.
To typeset verbatim material you need to use, for example, the verbatim
environment (in your code snippet you only selected a font for verbatim material) and manually introduce line breaks (I commented out some lines because I don't have uarial.sty
):
\documentclass[11pt,table,a4paper]{article}
\usepackage{array,ragged2e}
%\usepackage[scaled]{uarial}
\usepackage[T1]{fontenc}
\makeatletter
%\def\verbatim@font{\normalfont\ua1}
\makeatother
\begin{document}
\begin{verbatim}
This is my sample text for checking % character. I found
whereever there is % character it is treated as comment
and nothing gets printed after this. How can i fix this pblm.
I m using verb still getting same pblm. pls help me how
can i fix this pblm.
\end{verbatim}
\end{document}
![enter image description here](https://i.stack.imgur.com/p2J9o.png)
The fancyvrb
packages offers more possibilities and enhanced verbatim environments/commands; the listings
package extends even more the possibilities.
If all that you need is to typeset the percentage character, use \%
:
\documentclass[11pt,table,a4paper]{article}
\usepackage{array,ragged2e}
%\usepackage[scaled]{uarial}
\usepackage[T1]{fontenc}
\begin{document}
\begin{minipage}{0.3\linewidth}
This is my sample text for checking \% character. I found whereever there is \% character it is treated as comment and nothing gets printed after this. How can i fix this pblm. I m using verb still getting same pblm. pls help me how can i fix this pblm.
\end{minipage}
\end{document}
![enter image description here](https://i.stack.imgur.com/az80R.png)
Best Answer
You just escape the #.