Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts #261

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 78 comments
Open

Scripts #261

GoogleCodeExporter opened this issue Mar 14, 2015 · 78 comments

Comments

@GoogleCodeExporter
Copy link

I open this issue for people to post their scripts here (for lack of a
better way).

I start by adding a script to inline bibliographies. When submitting papers
to journals, they typically want all data contained in one single file (the
.tex file) - they don't support (external) BibTeX files. The attached
script opens the .bbl file associated with the currently open .tex file and
copies its contents to the current cursor position.
Note that this script saves the file before opening the .bbl file. This can
lead to a "Save File" dialog. This is necessary as this is the only way I
could think of right now to ensure that we're not working on a new
(unsaved) document, which would cause problems.

Original issue reported on code.google.com by st.loeffler on 26 Dec 2009 at 2:52

Attachments:

@GoogleCodeExporter
Copy link
Author

Note:
To use scripts, you need at least Tw 0.3 (the current development version at 
the time
of writing). To install scripts, put them in the Tw scripts folder. Simply 
click on
"Show Scripts Folder" in the "Scripts" menu of Tw (alternatively, navigate to 
the
"scripts" folder in your Tw configuration folder by hand; see TipsAndTricks on 
the
wiki to locate it). Then, click on "Update Scripts" in the "Scripts" menu of Tw 
(or
restart Tw).

Original comment by st.loeffler on 26 Dec 2009 at 2:56

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Thanks Stefan, I only just found this. I'll put some scripts that I had 
attached as 
comments to the wiki entry here instead.

Original comment by paul.a.norman on 20 Apr 2010 at 4:29

@GoogleCodeExporter
Copy link
Author

Sometimes when in pdf preview, you decide to re-typset and need to see the 
output 
console in the source.

Original comment by paul.a.norman on 20 Apr 2010 at 4:50

Attachments:

@GoogleCodeExporter
Copy link
Author

When using a master document, you may wish to open a selected file name, or one 
in 
an \input{filename.tex} just position the cursor between the {braces} (useful 
until 
project management tools are able to be developed)

Original comment by paul.a.norman on 20 Apr 2010 at 4:53

Attachments:

@GoogleCodeExporter
Copy link
Author

Show/Open the current file's folder/directory - MW Windows specific easily 
adapted 
other OS.

Original comment by paul.a.norman on 20 Apr 2010 at 4:55

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Import File Contents off Disk into Tw Editor - MS Windows specific but easily 
adapted.

Original comment by paul.a.norman on 20 Apr 2010 at 10:20

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Convert Selected lines of text into an \item list, (Updated:) presents drop 
down box 
with some LaTeX environments to choose from. 

Ignores/deletes blank lines, and leaves the User to handle any of their own % 
comment lines.

Original comment by paul.a.norman on 24 Apr 2010 at 7:17

Attachments:

@GoogleCodeExporter
Copy link
Author

I needed a "scratch pad" asociated with any/each .tex document on demand - a 
place 
to keep notes and almost a "to do"  for esp. when working with multiple 
documents 
under a master document. Put someting in the "Issues" list, but did this as a 
temporary measure or/ in case it is seen as not worth adopting in the main 
editor.

There are three scripts so far.

The first (1) scratchPad.js

This .Js (MS Specific but alterable) creates a text file based on the .tex 
document 
name in the same directory, 
So one  for: 
  a) My-First.tex    
would look like:  
  b) My-First_tex-Scratch-Pad.txt

If the file exists, it is opened, if not it is created and opened. Then the 
windows 
are placed a) left and b) right.

If you are in a ...tex_Scratch-Pad.txt document and call this script (1) it 
will 
find and show the main editing document it bleongs to.

If the scratch-pad document does not yet exist, this script (1) above must be 
run 
first before the other scripts are going to be used.

Recomend using editor book marks 

%: blah something blah 

     and Tw- Menu/   Window/Show/Tags   in each document.

The second Script  (2) scratchPadCopyTexTorTag.js will copy selected text or 
selected bokmark tag between the two editors, make sure that the cursor is 
where you 
want it in the opposite editor first.

And the third script (3) scratchPadNewTagInBoth.js will create a new identical 
bookmark in both editors at once. Again make sure that the cursor is where you 
wnat 
it in both editors first.

Scripts (1), (2), and (3) can be run from either editor, and will find the 
other 
one, but again please make sure that if the scratch pad has not yet been 
created, 
run script  (1) scratchPad.js first (it will do no harm in any event).

I have found these scripts very useful during selection/holding of researech 
material for specific subdocuments.

Please try and improve these, and point out any problems to me.

I updated them 28-04-2010, to give more descriptive and informative variable 
names, 
and to make the text editor windows place beside eachother for each script.

Paul

Original comment by paul.a.norman on 28 Apr 2010 at 10:05

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Please, help: I tried two script examples with the last version of tw 03.r.567
but with debugging information

Uncaught exception at C:/Documents and
Settings/horák/TeXworks/scripts/inlineBib.js:13: ReferenceError: target is not 
defined

The TW sees the scripts, allows their debugging, but...?

Karel Horak

Original comment by hor...@math.cas.cz on 8 May 2010 at 1:52

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Insert Cross Reference

This script makes a list of \label{s} in the active document, and offers a drop 
down 
box to chose one, and another drop down box to choose a cross-reference type ( 
\ref or 
\pageref).

(Also has the base for a generic simple find \command{} function)

Original comment by paul.a.norman on 9 May 2010 at 5:28

Attachments:

@GoogleCodeExporter
Copy link
Author

Format Selected Text Characters 

Presents a drop-down box to choose one of these standard LaTeX character formats
and applies it to highlighted text in the Tw editor.

\textnormal  textnormal  main document font  
\textrm  rmfamily  roman  
\textit  itshape  italics  
\emph  n/a  emphasis  
\textmd  mdseries  medium weight (default)  
\textbf  bfseries  boldface  
\textup  upshape  upright (default)  
\textsl  slshape  slanted  
\textsf  sffamily  sans serif  
\textsc  scshape  small caps  
\texttt  ttfamily  typewriter  
\underline  underline  underline  
\textsuperscript  n/a  this is superscript  

List from:--
 Section 5.2 
 LATEX for Word Processor Users
 version 1.0.6
 Guido Gonzato, Ph.D. 
 November 7, 2009

page: latex4wpsu30.html#x42-480005.2.3

Original comment by paul.a.norman on 20 May 2010 at 7:56

Attachments:

@GoogleCodeExporter
Copy link
Author

Set Size for Selected text or rest of document

Presents a drop-down box with the Standard LaTeX font sizes from  tiny -to- Huge

For clarity in the editor--

If one or two words are selected {\tiny myWord} format is used
If three or more words are selected \being{tiny}myFirstWord mySecondWord 
myThirdWord\end{tiny} format is used
And if nothing is selected, the command is simply inserted with a space before 
and 
after.  \tiny 

Original comment by paul.a.norman on 20 May 2010 at 12:42

@GoogleCodeExporter
Copy link
Author

Set Size for Selected text or rest of document

Presents a drop-down box with the Standard LaTeX font sizes from  tiny -to- Huge

For clarity in the editor--

If one or two words are selected {\tiny myWord} format is used
If three or more words are selected \being{tiny}myFirstWord mySecondWord 
myThirdWord\end{tiny} format is used
And if nothing is selected, the command is simply inserted with a space before 
and 
after.  \tiny 

Original comment by paul.a.norman on 20 May 2010 at 12:43

Attachments:

@GoogleCodeExporter
Copy link
Author

ulem package macros in a drop down-down box

Offers the various underlining and strike-through features of the ulem package. 

Checks for, and if apparently missing, offers to insert 
usepackage[normalem]{ulem} in 
the document preample.

  \uline{important}  
  \uuline{urgent}  
  \uwave{boat}  
  \sout{wrong}  
  \xout{removed} 

List from:--
 Section 5.2.1 
 LATEX for Word Processor Users
 version 1.0.6
 Guido Gonzato, Ph.D. 
 November 7, 2009

page: latex4wpsu30.html#x42-480005.2.3

Original comment by paul.a.norman on 20 May 2010 at 12:51

Attachments:

@GoogleCodeExporter
Copy link
Author

Insert a new \label{key}

If text is selected first in the Tw editor, the script endeavours to use this 
as the key to 
make a new \label{key}

Checks through the current document, and offers a drop-down box with either a 
blank area to 
type in, or if the user has selected some text, that as the proposed label key. 
The drop-
down shows any already existing label keys in the document.

If the user Ok-s the drop-down box, the script then checks through existing 
labels to avoid 
reproducing the same key.

If the key has already been used in another \label{key} statement, the user is 
shown the 
pre-existing key, and asked to try making a new label up again. The same checks 
are 
performed recursively until either a unique key is made, or the user cancels.

Successful use, inserts \label{usersKey}

(Companion script to insertCrossRef.js)

Original comment by paul.a.norman on 21 May 2010 at 8:58

Attachments:

@GoogleCodeExporter
Copy link
Author

newLabelforCrossRefsEnvCheck.js

As for newLabelforCrossRefs.js Inserts a new \label{key} but does a check for 
an 
active/current environemnt e.g. \begin{figure} (Thanks to Stefan for this added 
suggestion.)

If a standard LaTeX environment is current where the cursor is, a prefix for 
the 
label name is suggested, and a brief description of the environment is given 
for User 
assistance and confirmation (may remind people that an environment has not been 
\end-
ed!). 

If a package or proprietary environment is current, a prefix abbreviation is 
generated and suggested.

These standard LaTeX2e environemnts are treated as proprietary.

"flushleft",,"Flushed left lines. "
"flushright",,"Flushed right lines. "
"center",," Centred lines. "

And this is ignored "document",,"Enclose the whole document. "

If no environment is current at the cursor position, then no specific prefix is 
suggested.  

chapter, section et al, are left for the user to determine

And the user is responsible as to whether any current environment or renewed 
environment fully supports \label{anyWay}

If text is selected first in the Tw editor, the script endeavours to use this 
as the 
key to make a new \label{key}

Checks through the current document, and offers a drop-down box with either a 
blank 
area to type in, or if the user has selected some text, that as the proposed 
label 
key. The drop-down shows any already existing label keys in the document.

If the user Ok-s the drop-down box, the script then checks through existing 
labels to 
avoid reproducing the same key.

If the key has already been used in another \label{key} statement, the user is 
shown 
the pre-existing key, and asked to try making a new label up again. The same 
checks 
are performed recursively until either a unique key is made, or the user 
cancels.

Successful use, inserts \label{usersKey} or \label{anyPrefix:usersKey}

Please advise of any problems or possible improvements.

(Companion script to insertCrossRef.js

Original comment by paul.a.norman on 22 May 2010 at 7:28

Attachments:

@GoogleCodeExporter
Copy link
Author

A scirpt to place any selected text into a multicols environment, presents a 
drop-
down box to choose the nuber of columns.

User responsible to make sure that the multicol package is somewhere in their 
document packages' heirarchy( it may already be included by other of the user's 
own 
packages) and the user is prompted on the Tw window's status tip, to do that.

Original comment by paul.a.norman on 25 May 2010 at 12:12

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

What means ReferenceError: TW is not defined ?

Original comment by krychaj...@gmail.com on 7 Jun 2010 at 3:42

@GoogleCodeExporter
Copy link
Author

It sounds like you use an old version of TeXworks that doesn't support the TW 
object.
Please update to the latest version.
If that is not the case, please specify in more detail in which situation this
problem occurs (what version of TeXworks are you using, on what operating 
system,
with which script file).

Original comment by st.loeffler on 7 Jun 2010 at 6:08

@GoogleCodeExporter
Copy link
Author

Searching within Large Paragraph(s) located by syncTeX from Tw Previewer.

  Out of discussion: -   http://tug.org/mailman/htdig/texworks/2011q1/003737.html

Standard Tw Find does not give multiple results for a Find performed within in 
a Selected area.

  INSTALLATION: Unzip anywhere under your Scripts folder (new folder or existing one or 
                none).

  USAGE:  Triple Click the target paragraph / select paragraph(s) first, then run this
          script. Shortcut Alt+L & ALt+S

If multiple results are found, a drop down selection box is presented to the 
User to choose from, otherwise if one result it found - the chosen result is 
jumped to and highlighted.

Script has much room for improvement ...

And could be partially automated if we had access to a global varible that 
could be updated at this point in PDFdocument.cpp Line 1464 (ver 0.3 rev 729)
TeXDocument::openDocument(QFileInfo(curDir, filename).canonicalFilePath(), 
true, true, synctex_node_line(node));

  http://code.google.com/p/texworks/issues/detail?id=472

paul.a.norman@gmail.com

Original comment by paul.a.norman on 10 Feb 2011 at 4:43

Attachments:

@GoogleCodeExporter
Copy link
Author

Clips Storage

Useful for reusable text, or blocks of LaTeX portions that need to be stored 
for later insertion in documents. Especially useful where defining a new LaTeX 
command in a .sty is not appropriate, as some change may be needed on each 
usage.

Selected text is stored in a directory structure within your Script directory 
tree. Such saved Text can be identified in a drop-down box and inserted into a 
document, or the saved text can be retrieved for editing itself. Saved portions 
are stored as plain uncompressed text that can be edited/updated by other 
applications.

Developed under Windows, may need tweaking on line 68 for use on MacOsx or 
Linux, haven't been able to test there.

Script written in QtScript and gives simple examples of the revised readFile, 
writeFile, System and openFileFromScript TwScript api calls and usage.

   Setup
   -----

   Unzip this script into its OWN ( <-essential) directory under <TeXworks config area>/scripts Make a new folder if necessary. (See  http://code.google.com/p/texworks/wiki/TipsAndTricks?can=5#Locating_and_customizing_TeXworks_resources   for further information if needed.)

   You'll need to turn on file access (both Read and Write) and System commands in Tw Menu: Edit/Preferences/Scripts  note the warnings there.

   USAGE
   -----

   If any text is selected in editor, will try to store it to disk.

   - else with no text selected in editor, it will try to retrieve text clip from disk and insert into editor / or edit previously saved text clip.

   Shortcut: Alt+S, Alt+C

Feedback much appreciated,

Paul
paul.a.norman@gmail.com

Original comment by paul.a.norman on 10 Feb 2011 at 5:35

Attachments:

@GoogleCodeExporter
Copy link
Author

 This is a temporary EXPERIMENTAL workaround in scripting for saving accepted words from spell checking marks.

  Use at Your own risk!

  MAKE a BACKUP of your current dictionary first!!!

 Installation: 
              put in any directory under your script folder. 

 Turn on both Read and Write permissions in Edit/Preferences/ Scripts

 First usage will ask you to select your dictionary (ending in .dic).

 Usage: 
        Selected text (User selects/double clicks - first) 
 is added to the user's current dictionary, if no text is selected in 
 editor, the current dictionary is opened for editing - look at the end of 
 it.

 Additions do not take effect until TeXworks is started again - meanwhile for
 current session, tell spell checker to ignore word after adding it.

 Shortcut: Alt+H & Alt+S

Original comment by paul.a.norman on 13 Feb 2011 at 10:21

Attachments:

@GoogleCodeExporter
Copy link
Author

This script runs TexDoc using a package name highlighted in the Tw editor.

This will either show package help or other choices if available.

If you are using and have MiKTeXes automatic package loading turned on, and are 
using a new package - compile your Tw document at least once before using this 
script if you want help for that package.

 Shortcut: Alt+T & Alt+D

 NEED: You'll have to turn on Edit.Preferences/Scripts System commands for this to work

 Install: anywhere in your script folder tree, 
           then Tw Menu Scripts / Scripting TeXworks/  Reload Script List

 USAGE: double click on a package name (select name) in Tw editor and use this short cut (above)

 You may need to associate Yap (or other) with .dvi files. On MikTex Yap.exe is in the 
 <MiTeX Location>\miktex\bin folder

 I origianlly did this as a Lua script in 2009-09-19

/*
 package = "texdoc " .. TW.target.selection
 os.execute(package)
--  TW.result = package;

*/

 But you would need to turn on other script plugins for that to work 
 - perhaps considered by some as even more dangerous than QtScript
 with System turned on :);)

paul.a.norman@gmail.com

Original comment by paul.a.norman on 13 Feb 2011 at 11:09

Attachments:

@GoogleCodeExporter
Copy link
Author

Hi,

I've started putting scripts on an extension of some web space I use, to make 
maintaining them  easier as discussed 
http://tug.org/mailman/htdig/texworks/2010q3/002955.html

Here are the current Help scripts I have done.

1. A script (Alt+F1 & Alt+1) for getting help on, packages (local and web), Faq 
(local and web) and genreal LaTeX commands (web).

http://twscript.paulanorman.com/downloads/?GeneralHelp


2. And another (Alt+F1 & Alt+2)  for getting  LaTeX2e help built in to the Tw 
Editor.

http://twscript.paulanorman.com/downloads/?Latex2eHelp

Appreciate any feedback especially on 1. above and working it on Mac.

Paul
paul.a.norman@gmail.com

Original comment by paul.a.norman on 14 Feb 2011 at 6:16

@GoogleCodeExporter
Copy link
Author

Get Translation - Experimental

More details, and Available on 
http://twscript.paulanorman.com/downloads/?GetTrans

Currently Windows Only. Useful for initial translation in TeXworks of small 
portions needed on the fly.

Usage: Highlight a block of text, a few small paragraphs or one big one.
       Run Script, choose languages (these will be remembered for current
       Tw editing session).
       Maximum of 1500 characters at a time will be processed 
        - will be clearly marked in results.
       Result is slightly preprocessed for LaTeX requirements.
       (Google's total daily combined limit for all TeXworks users of this Script 
       is presently 100,000 characters - on days that this is exceeded, 
       script wont work).

Gives a Scripting example of using TW.script.xxxGlobal(s) with JSON, and 
TW.system(). Utilises the Google Translation Api.

More details, and Available on 
http://twscript.paulanorman.com/downloads/?GetTrans

Original comment by paul.a.norman on 17 Feb 2011 at 6:03

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Off Keyboard Symbols - Characters

BRIEF:

Will take a string of unicode(s) hexidecimal numbers and insert as unicode 
character(s) 

Download / Updates:

http://twscript.paulanorman.info/downloads/?MakeUnicode

INSTALL:

Unzip to any directory under you TeXworks script directory - see 
http://code.google.com/p/texworks/wiki/TipsAndTricks?can=5#Locating_and_customiz
ing_TeXworks_resources   
for further information.

Allow decompression to `use folder names'.  

Change the Alt key combination if you want/need to avoid conflicts with any 
existing scripts.

Then use Tw Menu item, Scripts/Scripting TeXworks/Reload Scripts List

USAGE:

Any Os.

Write one or a list of hexadecimal for unicode characters separated by one 
space (as below) use a double  space to get a word space 
 e.g. 006c 006f  0054 0065

Select (highlight) the codes, and use short cut Alt+M&Alt+U, or position cursor 
with nothing selected and run shortcut

For example..

 0048 0065 006c 006c 006f  0054 0065 0058 0077 006f 0072 006b 0073

Would yield:

      Hello TeXworks 

Paul

Original comment by paul.a.norman on 10 Mar 2011 at 6:22

@GoogleCodeExporter
Copy link
Author

Hi,

A Windows Only Solution - short file names.

There are times in LaTeX, operating under Windows, when it is useful to be able 
to just insert the short "no spaces" version of a file name or path.

Dialogue box locates a file, and the windows short version of its name, is 
inserted in TeXworks document (no spaces in path).

Enable System access 
see: 
http://twscript.paulanorman.com/docs/html/files/TexWorksApplicationProgramingI.h
tml

Script Download: http://twscript.paulanorman.com/downloads/?ShortName
Note: (contains a CSRIPT call to activeX objects - see contained 
systemShortName.js)



Original comment by paul.a.norman on 17 Apr 2011 at 5:43

@GoogleCodeExporter
Copy link
Author

xcolor_svgnames_X11names.js

Version 0.4 - Sunday 17th, April, 2011

Displays some standard colours and offers some colour macro commands for 
insertion into Tw Document.

This is a prototype which will be developed when time permits.

Needs File read and write 
see: 
http://twscript.paulanorman.com/docs/html/files/TexWorksApplicationProgramingI.h
tml

Script Download:
http://twscript.paulanorman.com/downloads/?InsertColour

Original comment by paul.a.norman on 17 Apr 2011 at 10:51

@GoogleCodeExporter
Copy link
Author

Context based autocompleter for completing words used in the open document, 
arguments to label and ref and as a new feature filename autocompletion for 
include, input and includegraphics commands.

Guide to use.
1. start typing the long word that should be autocompleted
2. press "<crtl> + m" and the autocompleter will complete the word or at least 
make a suggestion for a completion. 
3. if not satisfied with the suggestion press "<crtl> + m" until the correct 
word is found.

Original comment by henrikmidtiby@gmail.com on 16 May 2011 at 3:48

Attachments:

@GoogleCodeExporter
Copy link
Author

Ok, here is a small script for completing an environment like \begin{something}

I think it is multi nesting safe - place cursor on a new line, where you want 
\end{something} and just activate with Alt E keys. It works from top down to 
where your cursor is, so it won't know if the environment is already ended past 
the cursor.

After some discussion on the list, I realised that I had always wanted this for 
myself when ever someone had mentioned it, and finally felt to have a real go 
at it!

Please let me know what breaks it.

Paul


Original comment by paul.a.norman on 17 May 2011 at 6:58

Attachments:

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Ok, found a few things that would break script mentioned in comment 61. Here is 
a link to a new download. Also script now enhanced to indicate which open 
Environments have not yet been closed in a document. Activates with Alt E 
twice,  Paul

http://twscript.paulanorman.com/downloads/?endEnvironment

Original comment by paul.a.norman on 18 May 2011 at 2:27

@GoogleCodeExporter
Copy link
Author

Smartwrap
=========

The built-in support for hard wrapping in TeXworks (version 0.4) is,
at best, very limited.  Smartwrap is a TeXworks script to support more
intelligent handling of hard wrapping in LaTeX files.

Features:

- Formats paragraphs by adding or removing hard wrapping.

- Applies to the paragraph containing the cursor, or to paragraphs in
  a selected region.

- Respects indentation levels.

- Tries hard to identify text which should not be reformatted such as
  equations, verbatim environments or lines containing comments.

Original comment by shibt...@gmail.com on 24 May 2011 at 3:41

Attachments:

@GoogleCodeExporter
Copy link
Author

Open Pdf in Acrobat Reader --

Was: http://code.google.com/p/texworks/issues/detail?id=261#c35

Here is a simplistic scripting implementation of a suggestion by Bruno to look 
at using pdfopen. Could use pdfclose if that is needed as well.

** Before Use - See license and disclaimer in Script File

Useful when acrobat reader needs to be used to check something like \pdfmarks

Regrettably at present this is Windows only - Bruno and I tried!

Utilises a hightech  in-built human observational facility for determing the 
poppler preview page number :) (your eyes)

Each call of this script will open a new instance of acrobat reader (a work 
around for a DDE issue if the document is requested for a new page number)

Under Windows at least the the acrobat reader pdf appears to still need to be 
closed prior to TeXworks Typesetting  taking place.

Text highlighted in the Tw editor would be used as a specified "named 
destination" (if you have any) see hyperref package, otherwise a page number is 
requested (optional - the box can be canceled).

Feedback appreciated please,

Paul

Original comment by paul.a.norman on 11 Jun 2011 at 12:45

Attachments:

@GoogleCodeExporter
Copy link
Author

Auto Prompt for very basic document version backup scheme

http://paulanorman.info/twscript/downloads/index.html?VersioningBasic

Two hook scripts that run on File Open, and Typeset (success or failure)
 with a prompt offering to make a backup (with date and time in file
  name) in a location of your choosing.  

Standard locations are listed, and there is an option to choose a new
 backup location. Each distinct new save location is stored, and
  presented as an option during further uses of the script(s).

After a custom location is first used, the last used folder will appear
 in the top of the drop down on successive script runs.

Additionally there is a manually run script, for creating a version
 backup at any time.

Paul

Original comment by paul.a.norman on 10 Jul 2011 at 12:05

@GoogleCodeExporter
Copy link
Author

I have migrated my scripts to https://github.com/stloeffler/TeXworks-scripts as 
well as updated them and commented them (a little). These are:
- "Inline bibliography" (does what the name suggests; required for some 
scientific journal submissions)
- "Open containing directory" (opens the directory containing the active file; 
similar to Paul's script above, but should work on all platforms)


Additional scripts will be added there. I've also deleted my previous comments 
containing the old revisions.

Original comment by st.loeffler on 27 Jul 2011 at 12:08

@GoogleCodeExporter
Copy link
Author

Hi, 

Here is a third look at a Script for helping people start new scripts for 
TeXworks. This one ver 0.311 has a minor fix to the end of a Lua script header.

It now forms the header for QtScript, Python and Lua scripts, and can 
incorporate any new scripting engines that may be added later.

Helps set up the header correctly - I hope :)  Can be modified for other Script 
languages easily.

Put into a sub-directory under your scripts folder.

In Scripts menu "Reload Scripts List"

If Preferences / Scripts / Write is turned on, it will remember the Author's 
Name for future use. If you don't want to do that just edit "Your Name" out of 
authorName.txt in which ever folder you put the script in from the zip.

Make a new document in Tw (click into the new document if necessary), and use 
Alt+N Alt+S (if you have not already allocated it for something else) or use 
Scripts Menu look for "Make Script".

Comments, feed back, appreciated please,

Paul

Original comment by paul.a.norman on 5 Nov 2011 at 3:45

Attachments:

@GoogleCodeExporter
Copy link
Author

SCRIPT Collection: text Styles, Sizes, (Ulem) Special Underlining and Strike 
through

Combines as a collection and updates three previous scripts in this list.

http://code.google.com/p/texworks/issues/detail?id=261#c18

http://code.google.com/p/texworks/issues/detail?id=261#c19

http://code.google.com/p/texworks/issues/detail?id=261#c21

SHORTCUTS:

Text Sizes - Alt T  Alt S
Font Styles - Alt C  Alt S  (character Style)
ulem Special Underlining - Alt S  Alt U

VERSION: 0.1

RELEASE DATE:  Tuesday 8th, November, 2011

BRIEF:

Drop Down boxes to provide LateX 

    text size, 
               {\large upto three words} 
               \begin{large}Some more and more\end{large}          
               \large 
    text style, 
               \textit{} 
               {\itshape } 
               \itshape 

and ulem package special underlining,
                 wavy, double  
                 line-wrap-single-underline
                 also strikeout and X-through.

Go to http://twscript.paulanorman.com/downloads/?textStylesSizesUlemUnderlining

Paul

Original comment by paul.a.norman on 8 Nov 2011 at 10:46

@GoogleCodeExporter
Copy link
Author

Previous Comments 13 and 14 on this issue 261, covering openAllinputs-tex.js 
have been replaced by a replacement  script, link below, by Henrik Skov Midtiby

https://github.com/henrikmidtiby/autocompleteForTexworks/blob/master/scripts/ope
nAllinputs-tex.js

Paul

Original comment by paul.a.norman on 11 Nov 2011 at 10:33

@GoogleCodeExporter
Copy link
Author

Can someone please tell me how to add a keyboard shortcut to the 
openContainingDirectory script? I tried adding "// Shortcut: Ctrl+e" but that 
doesn't work.

Original comment by dpak.che...@gmail.com on 23 Dec 2011 at 3:40

@GoogleCodeExporter
Copy link
Author

Hi,

// Shortcut: Ctrl+e

Might already be assigned in one of your TeXworks scripts, plus you need to
have run

    Menu>Scripts / Scripting TeXworks/ Reload Script List

to get newly added scripts and shortcuts working, or just restart TeXworks
after saving the script in the Scripts folder sub tree.

I tried Stefan's script with

// Shortcut: Alt+O, Alt+C, Alt+D

(When using, hold the Alt down and tap OCD release Alt)

I use three letter short cuts now (but you don't have to) to leave room for
expansion, and they are very easy to remember if based on the Script name
-- here Open Containing Directory.

Remember if you change a shortcut, save the .js file, and do the reload
thing mentioned above to see the changes work.

Paul

Original comment by paul.a.norman on 23 Dec 2011 at 11:53

@GoogleCodeExporter
Copy link
Author

Hi,

I've got a bit of a temporary unofficial list of some available scripts, and 
locations to get them from, on the first page at 
http://twscript.paulanorman.info

Paul

Original comment by paul.a.norman on 11 Jan 2012 at 5:36

@GoogleCodeExporter
Copy link
Author

Here is a proof of concept for version checking on the web.

checkTexWorksVersion.js needs to go under your TeXworks Scripts folder.
Activate with ALT C T V

That will run on twscript.paulanorman.info

You can put TeXworksCheckVersion.txt and TeXworksCheckVersion.html on any 
local/wide web server and they will work in any JavaScript enabled browser.

Edit the numbers in TeXworksCheckVersion.txt, and the address http:// in 
checkTexWorksVersion.js

I think that we need some sort of easier exposure to script of release and 
version strings please.

Paul

Original comment by paul.a.norman on 16 Jan 2012 at 12:17

Attachments:

@GoogleCodeExporter
Copy link
Author

Hi, 
Here are some useful scripts I implemented:

/* GLS */
/* It converts an acronym or glossary entry to \gls{...} as it sets toLowerCase 
and if the text ends in 's' it assumes the plural form \glspl{...}. If no 
selected text, it creates the \gls{} and puts the cursor inside.*/

var selTxt = cursor.selectedText();
var txt = selTxt.toLowerCase();

if(selTxt.charAt(selTxt.length-1)=='s') {
 editor.write("\\glspl{"+txt.substring(0,txt.length-1)+"}");
} else {  
 editor.write("\\gls{"+txt+"}"); 
}

if(selTxt.length==0) cursor.shift(-1);
cursor.clearSelection(); 

/*Auto Itemize*/
/*It adds itemize to the text block whilst assuming each new line the item 
separator*/

var selTxt = cursor.selectedText();

if(selTxt.length>0) {
    editor.write("\\begin{itemize}\r");
    editor.write("\t\\item ");
    var resText = selTxt.replace(/(\r\n|\n|\r)/gm,"\r\t\\item ");
    editor.write(resText);
    editor.write("\r");
    editor.write("\\end{itemize}");
} else { editor.write("\\begin{itemize}\r\t\\item \r\t\\item \r\t\\item 
\r\\end{itemize}"); }
cursor.clearSelection();

I don't know if this is the right place to say this but I would appreciate if 
someone put a close button in the message/log file panel so that every time my 
tex has errors I have not have to go to the view options and disable it.

Miguel

Original comment by miike...@gmail.com on 23 May 2012 at 4:57

@GoogleCodeExporter
Copy link
Author

Hi,

Here is an update for the basic LateX2e help dialogue that removes the 
requirement of  having to have the TeXworks debugger on, as reported by Juan 
Leal.

Thread: http://tug.org/pipermail/texworks/2013q1/005712.html

New Download: http://twscript.paulanorman.info/downloads/?Latex2eHelp

Kind regards,
Paul

Original comment by paul.a.norman on 18 Feb 2013 at 1:01

@GoogleCodeExporter
Copy link
Author

Dear Paul,

I followed all the instructions but the backup file is void all the times.
I am running under Ubuntu and I use Texworks.

I have never scripted myself before!

Thanks

Anna (writing her PhD Thesis)

Original comment by anuskita...@gmail.com on 24 Sep 2013 at 5:18

@GoogleCodeExporter
Copy link
Author

Sorry Paul, now it works fantastically well :)
I said everything yes in the script's preferences (I had the option you said 
activated already) and now it works.

Thanks so much for sharing. When I finish I will try to get into scripting,
in order to save collectively a collection of files, like the thesis chapters.

Best wishes,

Anna

Original comment by anuskita...@gmail.com on 24 Sep 2013 at 5:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants