![왜 \shorthandon과 \shorthandoff를 다른 매크로에 삽입할 수 없나요?](https://rvso.com/image/286988/%EC%99%9C%20%5Cshorthandon%EA%B3%BC%20%5Cshorthandoff%EB%A5%BC%20%EB%8B%A4%EB%A5%B8%20%EB%A7%A4%ED%81%AC%EB%A1%9C%EC%97%90%20%EC%82%BD%EC%9E%85%ED%95%A0%20%EC%88%98%20%EC%97%86%EB%82%98%EC%9A%94%3F.png)
\title
매크로를 둘러싸면 '의 언어('?', '!', ':' 및 ';' 앞에 공백이 추가됨) \shorthandon{;:!?}
로 \shorthandoff{;:!?}
예상되는 결과를 제공합니다 .babel
french
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
%
\shorthandon{;:!?}%
\title{La crise? Quelle crise?}
\shorthandoff{;:!?}%
%
\begin{document}
\maketitle
\end{document}
\shorthandon
그러나 매크로에 및 가 포함된 경우에는 작동하지 않습니다 \shorthandoff
(재정의) \title
.
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
%
\let\titleORI\title
\renewcommand{\title}[1]{%
\shorthandon{;:!?}%
\titleORI{#1}%
\shorthandoff{;:!?}%
}
%
\title{La crise? Quelle crise?}
\author{Un auteur? Deux auteurs!}
%
\begin{document}
\maketitle
\end{document}
그 이유는 무엇입니까? 해결 방법이 있나요?
답변1
말하는 것은 활동적인 성격을 \shorthandon{?}
만든다 . ?
따라서 인수 to가 \title
흡수되면 첫 번째 예에서는 활성화되고 에서 \maketitle
LaTeX는 에 의해 정의된 현재 정의를 사용합니다 babel-french
.
반대로, 두 번째 경우에는 \shorthandon
인수가 \title
이미 흡수되었을 때 명령이 실행되므로 ?
활성화되지 않고 영원히 유지됩니다( 제목을 저장하는 \@title
매크로인 의 대체 텍스트에서).\title
\shorthandon
인수 가 실행된 후에는 인수 읽기를 지연해야 합니다 .
\documentclass[french]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\let\ORItitle\title
\renewcommand{\title}{%
\shorthandon{;:!?}%
\titlewithshorthand
}
\newcommand{\titlewithshorthand}[1]{%
\ORItitle{#1}%
\shorthandoff{;:!?}%
}
\title{La crise? Quelle crise?}
\begin{document}
\maketitle
\end{document}
그러나 나는 \title
단순히 \begin{document}
.