[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] (New?) No indentation in some circumstances
From: |
Mosè Giordano |
Subject: |
Re: [AUCTeX] (New?) No indentation in some circumstances |
Date: |
Mon, 20 Jun 2016 23:37:59 +0200 |
Hi *Denis*,
2016-06-20 16:44 GMT+02:00 Denis Bitouzé <address@hidden>:
> Hi Mosè,
>
> Le 19/06/16 à 23h24, Mosè Giordano a écrit :
>
>> Hi Denise,
>
> Denise is a female name and mine is Denis, a male one ;)
oh my bad, I have a (female) friend called Denise, that's why I'm more
used to type Denise than Denis, sorry :-)
>> Are you sure it used to work in this case?
>
> Yes, I am quite sure as I didn't noticed this behavior earlier in
> multiple files where several parts of the code are of the same kind.
>
>> If you could provide a version where it worked we could try to look
>> for the culprit.
>
> Well, I don't know how to go back to earlier versions of AUCTeX.
>
>>> Do you know what's going on?
>>
>> I think you got it right: unbalanced "\begin" and "\end" are a
>> problem.
>
> Sigh...
To be honest, I don't remember a "recent" change that could have
broken this kind of indentation. I trust you if you tell me that it
worked at some point in the past, but having a working version to
compare would be really great in order to try and fix this problem.
>> A couple of possible dirty workarounds: if possible, move the
>> offending code in a separate file in order not to break indentation
>> for the rest of the code;
>
> Probably a bit overkilling...
Didn't I tell you it was "dirty"? :-D
>> make "\newcommand" a verbatim command (I don't remember it it's
>> possible to do it for two-argument macros, though).
>
> I will loose automatic indentation within arguments of such verbatim
> command, isn't it?
Yes, but I don't think "\newcommand" is an often-used command,
especially with long arguments.
>> In addition, can't you do the conditional test on the argument of
>> "\begin{tabular}" only and call "\begin{tabular}" just once?
>
> The following, for instance, fails because of "! Argument of \ifthenelse
> has an extra }":
>
> --8<---------------cut here---------------start------------->8---
> \documentclass{article}
> \usepackage{xifthen}
> \begin{document}
> \newcommand{\blah}{%
> \textbf{%
> blah%
> }%
> }
> \newcommand*{\bleh}{%
> \begin{tabular}%
> address@hidden
> {l}%
> }{%
> {r}%
> }%
> bleh
> \end{tabular}
> }
> \newcommand{\blih}[1]{%
> \textbf{%
> blih%
> }%
> }
>
> \bleh
> \end{document}
> --8<---------------cut here---------------end--------------->8---
I was thinking about something like
--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{xifthen}
\newcommand*{\bleh}{%
\begin{tabular}{\ifthenelse{\isnamedefined{foo}}{l}{r}}
bleh
\end{tabular}
}
\begin{document}
\bleh{}
\end{document}
--8<---------------cut here---------------end--------------->8---
but not exactly this because it won't work. You should ask for help
on a specialized *TeX forum or mailing list, I think this would be the
best solution, both for readability and to avoid the problem you ran
into.
Bye,
Mosè