[SVN] r6599 (SWeave)

Charilaos Skiadas skiadas at hanover.edu
Fri Feb 16 06:49:28 UTC 2007


On Feb 16, 2007, at 1:29 AM, Allan Odgaard wrote:

> On 15. Feb 2007, at 16:19, Charilaos Skiadas wrote:
>
>> Added macro that fixes the code block intent, for the cases when  
>> copying and pasting has messed it up. (The begin-end lines (<< and  
>> @) for Sweave code blocks have to start at the beginning of a line).
>
> I think this should be removed.
>
> Copy/paste messing the indent, do: ⌘Z + ⌃⌘V (i.e. re-paste w/o  
> indent).
>
> If it’s already wrong, use ⌘[ to decrease the indent, until the  
> << / @ lines hit the left border.

The problem is that it's not all wrong, the LaTeX part should follow  
the regular indenting rules, but the code blocks should be moved,  
because Sweave only recognizes them as blocks only when they are at  
the beginning of a line. For example, suppose the text to be pasted is:

<<>>=
	2 + 3
@
\begin{center}
	foo bar
\end{center}
<<>>=
	2 + 3
@

And it is pasted right below the \begin{document} line here:

\begin{document}

\end{document}

Then we should be ending up with:

\begin{document}
<<>>=
	2 + 3
@
	\begin{center}
		foo bar
	\end{center}
<<>>=
	2 + 3
@
\end{document}


I suppose this makes more sense if you view it in monospaced font ;)

The macro I have is actually not ideal either, it produces this instead:

\begin{document}
<<>>=
		2 + 3
@
	\begin{center}
		foo bar
	\end{center}
<<>>=
		2 + 3
@
\end{document}


But I couldn't figure out how to do it in an easy way.

Haris





More information about the textmate-dev mailing list