Skip to content

Instantly share code, notes, and snippets.

@ptigas
Created September 15, 2010 16:18
Show Gist options
  • Select an option

  • Save ptigas/580985 to your computer and use it in GitHub Desktop.

Select an option

Save ptigas/580985 to your computer and use it in GitHub Desktop.
--Applescript direct
on replaceText(find, replace, subject)
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to find
set subject to text items of subject
set text item delimiters of AppleScript to replace
set subject to "" & subject
set text item delimiters of AppleScript to prevTIDs
return subject
end replaceText
set replacedText to the content of the selection of the front document
set replacedText to replaceText("For","\\textbf{For}", replacedText)
set replacedText to replaceText("To","\\textbf{To}", replacedText)
set replacedText to replaceText("Do","\\textbf{Do}", replacedText)
set replacedText to replaceText("End","\\textbf{End}", replacedText)
set replacedText to replaceText("If","\\textbf{If}", replacedText)
set replacedText to replaceText("Else","\\textbf{Else}", replacedText)
tell application "TeXShop" to set the selection of the front document to replacedText
@ptigas

ptigas commented Sep 15, 2010

Copy link
Copy Markdown
Author

[Latex] Emhasize \textbf{} algorthim keywords in selected text in TexShop OSX.

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