1

I'm working on a latex document

\documentclass{exam}
\printanswers

% to use the tag
% \usepackage{catchfilebetweentags}
% \ExecuteMetaData[file.tex]{tag}

%<*afterclass>

\begin{document}

\begin{questions}
  \question What is the first sentence of \emph{Moby Dick}?
  \begin{solution}
    \emph{Call me Ishmael.}
  \end{solution}

\end{questions}

\end{document}

%</afterclass>

As the document grows, I find myself often issuing C-x h TAB to fix my formatting.

The problem is that this key sequence takes the two strings

%<*afterclass>
%</afterclass>

and places a space after the % character:

% <*afterclass>
% </afterclass>

This causes problems in another script. Is it possible to "protect" these two lines from this formatting?

1

The simple way is to set comment-padding to 0 in a buffer-local variable. However, that has the effect of removing spaces after the percent sign on every comment line. If that is problematic, you may have to patch (or better: advice) the function LaTeX-indent-line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.