![\lstinline 인수 안에 파이프 문자를 사용할 수 있나요?](https://rvso.com/image/305771/%5Clstinline%20%EC%9D%B8%EC%88%98%20%EC%95%88%EC%97%90%20%ED%8C%8C%EC%9D%B4%ED%94%84%20%EB%AC%B8%EC%9E%90%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%A0%20%EC%88%98%20%EC%9E%88%EB%82%98%EC%9A%94%3F.png)
저는 Listings 패키지를 사용하고 있는데 파이프를 시작 및 끝 문자로 사용하므로 명령 |
에 파이프 문자를 사용할 수 있는지 묻고 싶었습니다 .\lstinline
\documentclass[]{article}
\usepackage{listings}
\begin{document}
Here's some text and an if-statement: \lstinline|if(a == 5 || b == 3)|. %Not working as lstinline stops after the first character of the 'or'-sign |
\end{document}
어떤 도움을 주셔서 감사합니다!
답변1
로부터listings
선적 서류 비치(부분4.2 조판 목록):
\lstinline[<key=value list>]<character><source code><same character>
\verb
활성 언어와 스타일과 유사하게 작동 하지만 존중합니다. 이러한 목록은 선택적 인수에서 다르게 요청하지 않는 한 유연한 열을 사용하며 프레임이나 배경색을 지원하지 않습니다. 작성\lstinline!var i:integer;!
하고 받으실 수 있습니다var i:integer;
. 명령은 먼저 선택적 인수를 검색하므로[
as 를 사용하려면 최소한 하나의 빈 인수를 제공해야 합니다<character>
.
따라서 사용하는 동안 인라인 목록을 닫으려면 <character>
the를 사용해야 합니다 (실험적인 ... 사용법 <same character>
제외 ). 인라인 사용법과 충돌하지 않는 문자를 선택하십시오.{
}
\documentclass{article}
\usepackage{listings}
\lstset{basicstyle=\ttfamily}
\begin{document}
Here's some text and an if-statement: \lstinline!if(a == 5 || b == 3)!.
Or there is \lstinline+if(a != 3 && b !=3 || c != 4)+.
\end{document}