파일 텍스트 주위에 LaTeX 환경을 래핑하는 스크립트

파일 텍스트 주위에 LaTeX 환경을 래핑하는 스크립트

두 태그 사이에 파일 콘텐츠(Latex Source)를 래핑합니다. 이는 표시된 대로 중첩되어야 합니다.

...을 더한

\begin{question}
question.tex #This is Latex file with Question Source
\begin{solution}
Solution.tex  #This is latex source file for solution
\end{solution}
\end{question}

내 질문이 명확하지 않은 것 같습니다. 필요에 따라 조금 더

Out.txt에는 다음이 포함되어야 합니다.

\begin{question}
Contents of Question.tex File
\begin{solution}
Contents of Solution.tex file
\end{solution}
\end{question}

Question.tex의 내용은 라텍스 명령 등이 포함된 텍스트입니다. 이번에도 Solution.tex와 동일합니다.

답변1

돈 크리스티처럼댓글에 답변이 달렸습니다, 질문을 끝내기 위해 여기에 포함합니다.

{ printf %s\\n '\begin{question}'; 
  cat Question.tex; 
  printf %s\\n '\begin{solution}'; 
  cat Solution.tex; 
  printf %s\\n '\end{solution}' '\end{question}';
} > Out.txt 

중괄호는 일련의 명령을 엽니다. 명령의 모든 출력은 Out.txt 파일로 리디렉션됩니다. printf 문은 단순히 관련 텍스트 문자열을 인쇄하고 cat명령에는 Question.tex 및 Solution.tex 파일이 포함됩니다.

관련 정보