texworks icon indicating copy to clipboard operation
texworks copied to clipboard

Completion in references, citations

Open GoogleCodeExporter opened this issue 10 years ago • 13 comments

Since I haven't seen this on the list of planned features, I'd like to put
in a request for automatic completion of labels in \ref{} respectively
citation keys in \cite{} commands (a la Kile/Texmate et al.), if this is
not considered as a too advanced feature. (I've always found this to be
extremely helpful.)

Original issue reported on code.google.com by [email protected] on 12 Aug 2008 at 11:40

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

Agreed, this is a valuable feature, though I don't guarantee it'll get done for 
the first release.

(It would be good to have this in a generalized way, so as to support ConTeXt 
or other packages in addition to 
LaTeX.)

Original comment by [email protected] on 13 Aug 2008 at 9:03

  • Changed state: Accepted
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

See also description in http://code.google.com/p/texworks/issues/detail?id=51 
(issue closed as duplicate).

Original comment by [email protected] on 6 Oct 2008 at 1:53

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

I used to use Winedt as a pretty advanced user, but I like Texwork's simplicity 
and I 
am trying to switch to it.
However, I have to admit that the auto-complete function for \ref and \cite is 
definitely a "must have". I think this should be the absolute priority among 
the 
enhancements.
Thank you and congratulations for your excellent work!
Paolo

Original comment by [email protected] on 15 Feb 2010 at 11:01

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

This feature would be relatively straightforward to implement in a script. I 
contributed one such implementation 
for the Sublime Text editor, using Python. I would be happy to port it to 
Texworks. The only obstacle is the fact 
that right now Texworks scripts cannot bring up any kind of GUI element---say, 
a pop-up menu when you type 
\ref{ or \cite{, or launch the appropriate script, or else a dialog box in case 
there are many possible choices. 
This is what my Sublime Text package does (imitating Textmate).

I'm just waiting for GUI capabilities to appear :-)

Original comment by [email protected] on 16 Feb 2010 at 1:24

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

Issue 330 has been merged into this issue.

Original comment by st.loeffler on 14 Apr 2010 at 3:15

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

Is this still unsolved?!Disappointing... 

Original comment by [email protected] on 4 May 2011 at 2:14

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

It is solved in a script. Check this issue:
http://code.google.com/p/texworks/issues/detail?id=261
So maybe it makes sense to close this issue here.

Original comment by [email protected] on 4 May 2011 at 3:16

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

David: Could you tell me which one of the scripts there works for autocomplete 
the command \cite{}?

Original comment by [email protected] on 4 May 2011 at 7:49

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

Issue 526 has been merged into this issue.

Original comment by st.loeffler on 22 Aug 2011 at 7:02

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

The functionality is in a raw form available in the script 
autocompleterForTexworks available at [1]. The autocompleter currently searches 
in all the open files for words that can be used to complete the current word 
in front of the cursor (and for filenames for completing input and 
includegraphics).
All interaction with the script consists of activating it through its shortcut 
(default crtl + m).
See a video of the script in use at [2].

Best
Henrik

[1] 
http://raw.github.com/henrikmidtiby/autocompleteForTexworks/master/scripts/autoc
omplete.js
[2] http://www.youtube.com/watch?v=gRSq_OSxPec

Original comment by [email protected] on 19 Oct 2011 at 3:17

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

Well, I don't think that having *all words* of the text that from the first 
letter you type [ for instance \citep{d...] is exactly the functionality 
expected...

Original comment by [email protected] on 27 Nov 2012 at 10:57

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

Regarding comment 11.

The autocompletion script have been moved and can now be found at [1].

The script is context aware so the generated suggestions depends on the context 
of the cursor. As an example take the following small document.

"""
eqnOne
eqnTwo
eqnPTesting
eqnPower
\label{eqnPython}
\label{eqnPythagoras}
"""

If you start to write a reference (\ref), only labels present in other 
references and labels (\label, \ref, \pageref, \eqref) will be suggested.
The four lines below will illustrate what happens when the script is activated. 
Each newline indicates an invocation of the script.

\ref{eqnP              // Initial input when the script is activated
\ref{eqnPythagoras     // First suggestion
\ref{eqnPython         // Second suggestion
\ref{eqnPythagoras     // Back to first suggestion as all suggestions have now 
been shown.

If autocompletion is activated for the string "eqnP" the following would be 
suggested.

eqnP                   // Initial input when the script is activated
eqnPTesting            // First suggestion
eqnPower               // Second
eqnPythagoras          // ...
eqnPython              // ..
eqnPTesting            // Back to first suggestion as all suggestions have now 
been shown.

As you can see there is a different set of suggestions for the two different 
contexts.

[1] https://github.com/henrikmidtiby/TeXworks-scripts/tree/master/autocomplete

Original comment by [email protected] on 27 Nov 2012 at 11:27

GoogleCodeExporter avatar Mar 14 '15 10:03 GoogleCodeExporter

cfa6b57 implements "Edit > Insert Citations..." to choose citations based on .bib-files specified using a %! TeX bibfiles = first.bib, second.bib modline at the beginning of the file.

stloeffler avatar Nov 05 '17 13:11 stloeffler