목록으로 bash 형식 지정

목록으로 bash 형식 지정

저는 Linux Bash 관련 문서를 LaTeX로 작성하고 있습니다. 쉘 스크립트. 그리고 몇 가지 문제가 있습니다.

  • 줄 시작 부분에서 서식 지정을 시작하려면 어떻게 해야 합니까?
  • 두 기호 사이에 서식을 지정하려면 어떻게 해야 합니까? 단, 두 기호가 같은 줄에 있는 경우에만 가능합니다(예: <>).
  • 마이너스에서 공백으로 서식을 지정하는 방법은 무엇입니까?또는줄 끝(다음 줄 아님)?

여기 사진이 있습니다:

여기에 이미지 설명을 입력하세요

최소한의 작업 예제 코드는 다음과 같습니다.

\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage{listings}
\usepackage[dvipsnames]{xcolor}

\lstset{ %
    basicstyle=\ttfamily\footnotesize,
    commentstyle=\color{ForestGreen},
    frame=single,
    keywordstyle=\color{RoyalBlue},
    language=Bash,
    showstringspaces=false,
    %morekeywords={blue},
    morestring=[s][\color{Gray}]{<}{>},
    morestring=[s][\color{OrangeRed}]{\ -}{\ },
    morestring=[s][\color{OrangeRed}]{*}{\ },
    morestring=[s][\color{OrangeRed}]{|}{\ },
    morestring=[s][\color{OrangeRed}]{\&}{\ },
}

\begin{document}

Every time:
\begin{enumerate}
    \item the first string in a line: blue
    \item after a minus \enquote{-} (including itself), which followed a space, the string gets: red
    \item special signs \enquote{* | \&}: red
    \item after a hash \enquote{\#} (including itself): the complete line green
    \item between less/greater than \enquote{<>} (including itself): gray
    \item if a string starts with a slash \enquote{/}: this string black
    \item the rest: black
\end{enumerate}

\begin{lstlisting}
blue -red text
blue -red text  # green ...
blue-blue <gray>
blue * black    # green ...
blue -red <gray>
# green ...
/black/black/ blue -red 
blue -red /black/black/
blue -red black-black
blue black > black
blue black < black
blue -red && black -red <gray> || black -red
/black/black/ blue
\end{lstlisting}

\end{document}

관련 정보