csquotes의 MakeAutoQuote와 유사한 메커니즘을 사용하는 괄호 절

csquotes의 MakeAutoQuote와 유사한 메커니즘을 사용하는 괄호 절

괄호 절을 작성하기 위한 다음 매크로가 있습니다.

\makeatletter
\newcommand\incise[1]{%
    ---\,#1%
    \@ifnextchar.\relax{\@ifnextchar?{\@ifnextchar!{\@ifnextchar:{\@ifnextchar;\relax{\,---}}}}}
}
\makeatother

그러나 나는 csquote 패키지가 인용과 동일한 작업을 수행하고 싶었습니다. 라텍스 매크로 대신 활성 문자를 사용합니다.

따라서 LaTeX에서는 다음을 가질 수 있습니까?

The main sentence -(the parenthetical clause)-.

다음과 같이 변환되었습니다.

The main sentence \incise{the parenthetical clause}.

답변1

\catcode`*\active
\def*(#1)*{\incise{#1}}

다른 곳에서는 *(xxxx)*사용하지 않는 한 원하는대로 작동 합니다 ....*

답변2

csquotes 명령을 사용할 수 있습니다. \catcodeDavid의 트릭을 직접 사용할 수 없는 utf8 문자에서도 작동합니다. 주요 문제는 문서의 나머지 부분에 부작용이 발생하지 않도록 문자를 선택하는 것입니다.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{csquotes,xcolor}

\makeatletter
\csq@addspecial{ä}{\begingroup---!ups\color{red}}{}{}%
\csq@addspecial{ö}{\endgroup!ups---}{}{}
\makeatother

 \begin{document}
 äblubö blabla 

 \end{document} 

관련 정보