在 lstlisting 乳胶中输出带有英文字符而不是非英文字符的代码?
Output code with english characters instead of non-english in lstlisting latex?
我想在我的论文中插入一个ansys apdl代码代码文本。
我已经为我的代码 (english) 尝试了 \begin{lstlisting} 因为我有这个包。
我的论文模板被设置为将 greek 作为默认语言,所以当我在 latex 中编译 lstlisting 时,我得到了这个输出
latex output(希腊字符)。
我试过在 \begin{lstlisting} 的内部或外部使用 \eng{} 但无论哪种方式我都会得到希腊字符。
这是代码:
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
任何人都知道我怎样才能用英语字符而不是希腊语得到这段代码的输出?
一个最小的例子就是这样:
\documentclass[11pt,a4paper,fleqn]{article}
\usepackage{multicol}
\usepackage{xspace}
\usepackage[unicode,linktocpage,breaklinks]{hyperref}
\usepackage{textcomp}
\usepackage{breakurl}
% >> Math package:
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage[english,greek]{babel}
\usepackage[utf8x]{inputenc}
%\usepackage[iso-8859-7]{inputenc}
%\usepackage{kerkis}
\usepackage{parskip}
% improved layout of figure captions with extra margin, smaller font than text
\usepackage[margin=10pt,font=small,labelfont=bf,textfont = it]{caption}
%\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{babel,varioref}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{fixltx2e}
\usepackage{pstricks}
\usepackage{latexsym}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{enumerate}
\usepackage{babelbib}
\usepackage{url}
% \usepackage{multibib}
\usepackage{caption}
% TABLE OF CONTENTS PACKAGES
\usepackage[subfigure]{tocloft}
\usepackage{tocbibind}
% Line Spacing
\usepackage{setspace}
% fancy header
\usepackage{fancyhdr}
%\usepackage[unicode]{hyperref}
% footnotes: waring in case of splitted footnote
\usepackage{fnbreak}
% extra controlabity for enumerators
\usepackage{enumitem}
% Section headings format
\usepackage{titlesec}
%\usepackage{sectsty}
% appendix
\usepackage{appendix}
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
您可以使用\selectlanguage{english}
暂时切换到英文:
\documentclass[11pt,a4paper,fleqn]{article}
\usepackage{multicol}
\usepackage{xspace}
\usepackage[unicode,linktocpage,breaklinks]{hyperref}
\usepackage{textcomp}
\usepackage{breakurl}
% >> Math package:
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage[english,greek]{babel}
\usepackage[utf8x]{inputenc}
%\usepackage[iso-8859-7]{inputenc}
%\usepackage{kerkis}
\usepackage{parskip}
% improved layout of figure captions with extra margin, smaller font than text
\usepackage[margin=10pt,font=small,labelfont=bf,textfont = it]{caption}
%\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{babel,varioref}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{fixltx2e}
\usepackage{pstricks}
\usepackage{latexsym}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{enumerate}
\usepackage{babelbib}
\usepackage{url}
% \usepackage{multibib}
\usepackage{caption}
% TABLE OF CONTENTS PACKAGES
\usepackage[subfigure]{tocloft}
\usepackage{tocbibind}
% Line Spacing
\usepackage{setspace}
% fancy header
\usepackage{fancyhdr}
%\usepackage[unicode]{hyperref}
% footnotes: waring in case of splitted footnote
\usepackage{fnbreak}
% extra controlabity for enumerators
\usepackage{enumitem}
% Section headings format
\usepackage{titlesec}
%\usepackage{sectsty}
% appendix
\usepackage{appendix}
\begin{document}
Greek
{
\selectlanguage{english}
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
}
Greek
\end{document}
我想在我的论文中插入一个ansys apdl代码代码文本。 我已经为我的代码 (english) 尝试了 \begin{lstlisting} 因为我有这个包。 我的论文模板被设置为将 greek 作为默认语言,所以当我在 latex 中编译 lstlisting 时,我得到了这个输出 latex output(希腊字符)。 我试过在 \begin{lstlisting} 的内部或外部使用 \eng{} 但无论哪种方式我都会得到希腊字符。 这是代码:
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
任何人都知道我怎样才能用英语字符而不是希腊语得到这段代码的输出?
一个最小的例子就是这样:
\documentclass[11pt,a4paper,fleqn]{article}
\usepackage{multicol}
\usepackage{xspace}
\usepackage[unicode,linktocpage,breaklinks]{hyperref}
\usepackage{textcomp}
\usepackage{breakurl}
% >> Math package:
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage[english,greek]{babel}
\usepackage[utf8x]{inputenc}
%\usepackage[iso-8859-7]{inputenc}
%\usepackage{kerkis}
\usepackage{parskip}
% improved layout of figure captions with extra margin, smaller font than text
\usepackage[margin=10pt,font=small,labelfont=bf,textfont = it]{caption}
%\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{babel,varioref}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{fixltx2e}
\usepackage{pstricks}
\usepackage{latexsym}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{enumerate}
\usepackage{babelbib}
\usepackage{url}
% \usepackage{multibib}
\usepackage{caption}
% TABLE OF CONTENTS PACKAGES
\usepackage[subfigure]{tocloft}
\usepackage{tocbibind}
% Line Spacing
\usepackage{setspace}
% fancy header
\usepackage{fancyhdr}
%\usepackage[unicode]{hyperref}
% footnotes: waring in case of splitted footnote
\usepackage{fnbreak}
% extra controlabity for enumerators
\usepackage{enumitem}
% Section headings format
\usepackage{titlesec}
%\usepackage{sectsty}
% appendix
\usepackage{appendix}
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
您可以使用\selectlanguage{english}
暂时切换到英文:
\documentclass[11pt,a4paper,fleqn]{article}
\usepackage{multicol}
\usepackage{xspace}
\usepackage[unicode,linktocpage,breaklinks]{hyperref}
\usepackage{textcomp}
\usepackage{breakurl}
% >> Math package:
\usepackage{amsmath}
\usepackage{amsbsy}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{nicefrac}
\usepackage[english,greek]{babel}
\usepackage[utf8x]{inputenc}
%\usepackage[iso-8859-7]{inputenc}
%\usepackage{kerkis}
\usepackage{parskip}
% improved layout of figure captions with extra margin, smaller font than text
\usepackage[margin=10pt,font=small,labelfont=bf,textfont = it]{caption}
%\usepackage{xltxtra}
\usepackage{graphicx}
\usepackage{latexsym}
\usepackage{babel,varioref}
\usepackage{setspace}
\usepackage{subcaption}
\usepackage{fixltx2e}
\usepackage{pstricks}
\usepackage{latexsym}
\usepackage{multirow}
\usepackage{array}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{enumerate}
\usepackage{babelbib}
\usepackage{url}
% \usepackage{multibib}
\usepackage{caption}
% TABLE OF CONTENTS PACKAGES
\usepackage[subfigure]{tocloft}
\usepackage{tocbibind}
% Line Spacing
\usepackage{setspace}
% fancy header
\usepackage{fancyhdr}
%\usepackage[unicode]{hyperref}
% footnotes: waring in case of splitted footnote
\usepackage{fnbreak}
% extra controlabity for enumerators
\usepackage{enumitem}
% Section headings format
\usepackage{titlesec}
%\usepackage{sectsty}
% appendix
\usepackage{appendix}
\begin{document}
Greek
{
\selectlanguage{english}
\begin{lstlisting}
/AUX15
/UNITS,SI
IOPTN,IGES,SMOOTH
IOPTN,MERGE,YES
IOPTN,SOLID,YES
IOPTN,SMALL,YES
IOPTN,GTOLER, DEFA
IGESIN,'.arc_nosup_2','igs',' '
! APLOT
!*
FINISH
\end{lstlisting}
}
Greek
\end{document}