如何在逐字和代码示例中获取直单引号

如何在逐字和代码示例中获取直单引号

我的文档中有类似的内容print('abc'),但它变成了print(’abc’)(注意改变的引号),这会破坏编译。

我怎样才能使环境\begin{codeexample}\begin{verbatim}(奖励)打印出真实的引文?(请注意,我仍然希望源包含真实的引文',因为我仍然希望能够从比 PDF 更可靠的源文件中复制/粘贴内容)。

梅威瑟:

\documentclass[a4paper,doc2]{ltxdoc} % doc2 is needed to force the old version, or links get colored in a weird red way even with hidelinks. https://github.com/latex3/latex2e/issues/822

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Warning: if you compile and get:
%% ERROR: Argument of \tikz@lib@matrix@with@options has an extra }.
%% make sure to fix catcodes around it as | is given a different meaning in ltxdoc.

\usepackage{amsmath}
\usepackage[margin=3cm]{geometry}
\usepackage{calc}
\usepackage{tikz}
\input{pgfmanual-en-macros.tex}

\usepackage{tikz-cd}

\usepackage[hidelinks]{hyperref}
\usepackage{cleveref}

\begin{document}

\tableofcontents

\begin{verbatim}
Hey, see this is'nt copy/pastable due to the simple 'quotes' (but "double quotes" seem to be fine).
\end{verbatim}

\begin{codeexample}[code only]
Hey, see this is'nt copy/pastable due to the simple 'quotes' (but "double quotes" seem to be fine).
\end{codeexample}

\end{document}

相关内容