![格式更改](https://linux22.com/image/316678/%E6%A0%BC%E5%BC%8F%E6%9B%B4%E6%94%B9.png)
我想要一些文字显示如下
我没有得到准确的输出。我写的代码如下(请原谅我对 Latex 的了解不足)
\hspace{2mm} A simple paragraph of Verilog code is below in verbatim.\\
\begin{flushleft}
Always@(posedge LRCK)
\end{flushleft}
\hspace{5mm} Begin\\
\hspace{6mm} Counter=Counter+1\\
\hspace{6mm} If (Counter == 40)\\
\hspace{5mm}Begin\\
\hspace{6mm} Counter = 0\\
\hspace{5mm} $Phase\_control\_word = Phase\_Control\_word + 1 $
答案1
listings
下面是使用支持语言的包的示例Verilog
:
\documentclass{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language={Verilog},tabsize=12,caption={A simple paragraph of Verilog code is below in verbatim}]
Always@(posedge LRCK)
Begin
Counter=Counter+1
If ( Counter == 40)
Begin
Counter = 0
Phase_control_word = Phase_Control_word + 1
\end{lstlisting}
\end{document}
另一个示例tcolorbox
及其列表功能:
\documentclass{article}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcblisting}{listing options={language={Verilog},tabsize=12}, title={A simple paragraph of Verilog code is below in verbatim},listing only,colbacktitle=yellow, coltitle=black}
Always@(posedge LRCK)
Begin
Counter=Counter+1
If ( Counter == 40)
Begin
Counter = 0
Phase_control_word = Phase_Control_word + 1
\end{tcblisting}
\end{document}