Text FormattingGenerating straight apostrophes in verbatim environment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
tedfflamp
Posts: 2
Joined: Tue Jul 07, 2009 10:08 am

Generating straight apostrophes in verbatim environment

Post by tedfflamp »

Hi, i'm a bit depressed now as i can't decorate my Perl code listings.

I have some code (as an example):

Code: Select all

print <<EOF;
Цена $price.
EOF

print <<"EOF";
Цена $price.
EOF

print <<'EOF';
Цена $price.
EOF
To decorate this I use custom simple environment:

Code: Select all

\newenvironment{mylisting}
{\begin{list}{}{\setlength{\leftmargin}{1em}}\item\scriptsize\bfseries}
{\end{list}}
so i have something like

Code: Select all

\begin{mylisting}
\begin{verbatim}
... % listings there
\end{verbatim}
\end{verbatim}
Problem is i can't use curly apostrophes (generated with '), i need straight one (just like \textquotesingle in package textcomp). Any ideas?

P.S. Oh, I also cannot use listings package.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Generating straight apostrophes in verbatim environment

Post by localghost »

tedfflamp wrote:[...] P.S. Oh, I also cannot use listings package.
I wonder about the reasons which keep you from using the listings package. It would make things much easier.


Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
tedfflamp
Posts: 2
Joined: Tue Jul 07, 2009 10:08 am

Re: Generating straight apostrophes in verbatim environment

Post by tedfflamp »

Well, I need to comment my sources. But when i'm writing a few words in comment in my native language, it transforms into one line without spaces in pdf (and it looks like '# with floating point' in .tex and '# withfloatingpoint' in .pdf). I couldn't find a solution so I chose verbatim :).

But does it matter? Anyway, it gives me curly apostrophes even using listings. How to generate straight apostrophe using listings?
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Generating straight apostrophes in verbatim environment

Post by localghost »

tedfflamp wrote:Well, I need to comment my sources. But when i'm writing a few words in comment in my native language, it transforms into one line without spaces in pdf (and it looks like '# with floating point' in .tex and '# withfloatingpoint' in .pdf). I couldn't find a solution so I chose verbatim. [...]
Should be customizable in listings.
tedfflamp wrote:[...] But does it matter? Anyway, it gives me curly apostrophes even using listings. How to generate straight apostrophe using listings?
Seems to me more like a matter of the used font. Try mono spaced fonts like bera (beramono), inconsolata or luximono.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Post Reply