1. Type this Latex code in Latex editor:
% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode
\documentclass[12pt,letterpaper]{article}
\usepackage{fullpage}
\usepackage[top=2.5cm,bottom=2.5cm,left=2.5cm,right=2.5cm,columnsep=30pt]{geometry}
%% latex package to use the Verbatim environment or display verbatim
\usepackage{fancyvrb}
\usepackage{fvextra}
%% change default font To bold format
\renewcommand{\seriesdefault}{bx}
%% change the bold format To Huge size
\renewcommand{\bfseries}{\Huge{}}
\begin{document}
\subsection*{Notes}
\Large{}
\begin{minipage}{\linewidth}
To use the Verbatim environment or display verbatim you have to add the following line to the preamble of your document: \verb!\usepackage{fancyvrb}! and \verb!\usepackage{fvextra}!
\end{minipage}
\paragraph{}
\hspace{-1.5em}
\begin{minipage}{0.9\linewidth}
For longer (multiline) chunks of fixed-format text and automatic line breaking or wrap text, use the \texttt{\textbackslash{}fvset\{fontsize=\textbackslash{}Large,numberblanklines=false\}}
\texttt{\textbackslash{}begin\{Verbatim\}[breaklines=true, breakanywhere=true,numbers=left,
firstnumber=1]} (note the capital V letter). \\
Include your anything text in the Verbatim environment.
\end{minipage} \\
\noindent{}\raggedright{}
\subsection*{Sample:}
\huge{}
\fvset{fontsize=\Large
,numberblanklines=false
}
\renewcommand{\theFancyVerbLine}{%
\large\arabic{FancyVerbLine}}
\begin{Verbatim}[breaklines=true, breakanywhere=true,numbers=left,firstnumber=1]
% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode
\documentclass[12pt,letterpaper]{article}
\begin{document}
\begin{verbatim}
Hello World
\end{verbatim}
\end{document}
\end{Verbatim}
\paragraph{}
\noindent\raggedright{}\hspace{-1.5em} Normal Paragraph\\
\end{document}
2. Save file as CodeHighlightVerbatim2.tex
3. Then build or compile or typeset the Latex code.
Output
Notes
- Remember the V capital letter in \begin{Verbatim}[breaklines=true, breakanywhere=true] and \end{Verbatim}.
- To see more clear screen capture picture, click on the picture.
< previous How To Write A Code Block In Latex 1
<< Back to Learning Latex RoadMap
<< Back to Learn About Latex List 1
write latex code, verbatim environment
Tidak ada komentar:
Posting Komentar