Skip to content

Instantly share code, notes, and snippets.

@mratsim
Created November 27, 2016 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mratsim/b933af9f1e7be53d1f3cb613a42e0fbc to your computer and use it in GitHub Desktop.
Save mratsim/b933af9f1e7be53d1f3cb613a42e0fbc to your computer and use it in GitHub Desktop.
Macros to itemize, enumerate or wrap in function for TexStudio
%%Itemize
%SCRIPT
txt = cursor.selectedText()
txt = txt.replace(/^/gm, "\t\\item ")
editor.write("\\begin{itemize}\n"+txt+"\n\\end{itemize}\n")
cursor.clearSelection()
%%Enumerate
%SCRIPT
txt = cursor.selectedText()
txt = txt.replace(/^/gm, "\t\\item ")
editor.write("\\begin{enumerate}\n"+txt+"\n\\end{enumerate}\n")
cursor.clearSelection()
%%Apply Function
%SCRIPT
txt = cursor.selectedText()
editor.write("\\{"+txt+"}")
cursor.movePosition(2+txt.length, cursorEnums.Left);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment