General ⇒ Display backtick character
Display backtick character
I am working on a LaTex document and I am placing a piece of code in a verbatium block. This code comes from a language where the <backtick> (character below the tilde) is used. To print this code snippet I need to be able to print the backtick code and not have it show up as the open quotation marks. (standard backtick behaviour). How do I go about this?
Code I am inserting:
\begin{verbatim}
`include "file1"
`include "file2"
\end{verbatim}
Code I am inserting:
\begin{verbatim}
`include "file1"
`include "file2"
\end{verbatim}
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Display backtick character
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Display backtick character
Listings will not work as it does not support the language I am trying to post a snippet of. (Verilog HDL)
Display backtick character
The following code does exactly what you want, at least in my computer:
You may want to change the command chars if any is used in the programming language. The manual of the fancyvrb package can be found here
Code: Select all
Code, edit and compile here:
\documentclass{article}\usepackage[T1]{fontenc}\usepackage{fancyvrb}\begin{document}\newcommand{\BInclude}{\symbol{0}include}\begin{Verbatim}[commandchars=ç¿?]çBInclude "file1"çBInclude "file2"\end{Verbatim}\end{document}
Re: Display backtick character
Juanjo - thank-you for the reply, what you suggested works great! Much appreciated.
Display backtick character
Reading the manual of the listings package for a diferent matter, I realized that the problem here can be solved as follows:
The fontenc and textcomp packages are also required. This approach seems advantageous compared with that based on fancyvrb, since you can benefit from the facilities provided by listings to format the code.
Code: Select all
Code, edit and compile here:
\documentclass[a4paper]{article}\usepackage[T1]{fontenc}\usepackage{textcomp}\usepackage{listings}\begin{document}\begin{lstlisting}[upquote=true]`include "file1"`include "file2"\end{lstlisting}\end{document}
-
- Posts: 2
- Joined: Thu May 01, 2008 11:23 pm
Re: Display backtick character
This topic is very helpful but what I need is a backtick in line with other text which is in \texttt format.
The current solution puts everything into the new format, or just the backtick but with a blank line above and before it. What I really need is a command like \textbackslash something like \textbacktick. Could this be built into LaTeX 3 do you think?
Any help would be appreciated.
The current solution puts everything into the new format, or just the backtick but with a blank line above and before it. What I really need is a command like \textbackslash something like \textbacktick. Could this be built into LaTeX 3 do you think?
Any help would be appreciated.
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Display backtick character
LaTeX.org admin
Re: Display backtick character
Perhaps you may also want to try the \textasciigrave command provided by the textcomp package.
Display backtick character
I feel your pain but thanks to the LaTeX documentation project (http://www.latex-project.org/guides), I have an answer for you:
Forget textcomp and fontenc... they are not required. Instead, use the following:
Forget textcomp and fontenc... they are not required. Instead, use the following:
Code: Select all
Code, edit and compile here:
\lstset{language=Verilog,literate={`}{{$^{\backprime}$}}1}\lstinputlisting{verilog.v}