texworks
texworks copied to clipboard
Feature request: Add \end{<whatever>} by typing extra "}" after \begin{<whatever>}
Taken from WinEdt. If I type:
\begin{document}}
the second "}" causes the editor to automatically add the appropriate \end
statement, so I get
\begin{document}
*
\end{document}
with the cursor at the *.
Original issue reported on code.google.com by [email protected] on 24 Sep 2008 at 4:41
The "natural" TeXworks way to do this at the moment would be to have a
completion entry along the lines of
\bdoc:=\begin{document}#RET##INS##RET#\end{document}#RET#
which would allow you to type \bdoc<tab> to reach the same result.
A "smart closing brace" that recognizes any preceding \begin{whatever} and adds
the corresponding \end
seems a bit too specialized and LaTeX-specific to me. I don't want TeXworks to
have hard-coded LaTeX-isms
in the editor; it should be a general-purpose TeX editor that can be customized
for LaTeX, ConTeXt, or
whatever using an appropriate configuration.
What I hope to provide eventually is a scripting interface that you could use
to add functionality like this; I
think that's a better approach than building special "}" processing into the
core program. But it will be some
time before that interface is available.
Original comment by [email protected] on 29 Sep 2008 at 6:26
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
I see your point about being too specialised, so perhaps you are right about the
scripting. I guess that I am used to the multiple modes of my current editor,
where
this only happens in TeX mode.
Original comment by [email protected] on 29 Sep 2008 at 8:13
This is one of the best features of textmate, but it's configured separately for
LaTeX and ConTeXt. It uses alt-apple-dot shortcut (I think). One can use it an
any
time, it just writes \stopsomething in ConTeXt if \startsomething has been the
last
unclosed command sequence, or \end{something} for LaTeX. (There is probably no
plain
TeX support there.)
But it's also true that this is implemented rather generically with regular
expressions and not hardcoded.
Original comment by [email protected] on 27 Aug 2009 at 2:19
Thinking about this at some remove, it's likely best closed: probably one for scripting. (I was the original reporter ...)