명령 정의를 저장하는 방법은 무엇입니까? 아니면 로컬에서 명령을 비활성화하는 방법은 무엇입니까?

명령 정의를 저장하는 방법은 무엇입니까? 아니면 로컬에서 명령을 비활성화하는 방법은 무엇입니까?

무엇?

다음 논리가 작동하도록 \includegraphicsinto 의 정의를 "저장"하고 싶습니다 .\something

% the following line is what I am looking for
store(\includegraphics, \something)
% and then I want to achieve what follows

\renewcommand\includegraphics}[2][]
{}

\doalotofstuff

\renewcommand\includegraphics}[2][]
{%
get_the_definition_from(\something)
}

% now I can again use \includegraphics with its usual definition

가능하고 쉽게 달성할 수 있나요?

그런데 왜?!

\includegraphics내 문서의 일부 부분에서 명령을 비활성화하고 이후에 다시 평소대로 사용할 수 있기를 원합니다 \includegraphics. 이 질문은 다음과 관련이 있습니다.이 게시물\includegraphics( 명령이 활성화되어 있으면 솔루션이 작동하지 않습니다 .

답변1

당신은 다음과 같은 것을 원합니다

\usepackage{letltxmacro}

그리고

\LetLtxMacro\colassavedincludegraphics\includegraphics
\renewcommand\includegraphics[2][]{}

명령을 비활성화합니다. 다시 활성화해주셔서

\LetLtxMacro\includegraphics\colassavedincludegraphics

특정 명령의 경우 \let충분할 수 있지만 \LetLtxMacro선택적 인수를 허용하는 명령의 경우 더 안전합니다.

보다\LetLtxMacro는 언제 사용하나요?에 대한 자세한 내용은 \LetLtxMacro.

환경의 경우 정의 방법에 따라 다르지만 comment패키지가 유용할 수 있습니다.

답변2

당신이 찾고 있는 것 같습니다 \let:

\let\something=\includegraphics

관련 정보