1

Hello I was trying to put '\n' on codeblock, and I have just realized that my apostrophe is in weird direction when in codeblockenter image description here

I wanted something like

enter image description here

The code was

\documentclass{report}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{float}
\usepackage{amsmath}  
\usepackage[a4paper,margin=1in,footskip=0.25in]{geometry}
\usepackage{tcolorbox}
\usepackage{tikz}
\usepackage{scrextend}
\tcbuselibrary{breakable}

\definecolor{blue-green}{rgb}{0.0, 0.87, 0.87} \colorlet{mygray}{black!30} \colorlet{mygreen}{green!60!blue} \colorlet{mymauve}{red!60!blue}

\lstset{ mathescape, backgroundcolor=\color{gray!10},
basicstyle=\ttfamily, columns=fullflexible, breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{mygreen}, extendedchars=true,
frame=single,
keepspaces=true,
keywordstyle=\color{blue},
language=c++,
numbers=none,
numbersep=5pt,
numberstyle=\tiny\color{blue}, rulecolor=\color{black},
showspaces=false,
showstringspaces=false, showtabs=false,
stepnumber=5,
stringstyle=\color{magenta}, % morecomment=[l][\color{red}]{#},
tabsize=3,
title=\lstname,
emph = {true,false}, emphstyle = {\color{cyan}}, }

\begin{document} test \begin{lstlisting} '\n' \end{lstlisting}

\end{document}

(This is not just in codeblock but always like this. But I want to know how to use in codeblock.)

주성우
  • 133
  • 2
    Just add upquote=true to the list of arguments of \listset. See section 4.3.6. of the user guide of the listings package for more information. Actually, the remark in that section that it's necessary to load the textcomp package is no longer correct; some years ago, if I recall correctly, much of the functionality of the textcomp package was folded into the LaTeX kernel. – Mico Jan 29 '22 at 11:23
  • 1
    @Mico Thank you for your help! – 주성우 Jan 29 '22 at 11:27
  • Just noticed a (hopefully minor) typo in my earlier comment: the name of the command is \lstset, not \listset... I've looked up when textcomp was folded into the LaTeX kernel; it would appear to have occurred with the 2020/02/02 release. – Mico Jan 29 '22 at 11:37

0 Answers0