Make unix2doc a system service of OS X

Technology ,

Revising an academic paper is really a hard work. What makes things worse is that WinEdit used by my advisor is only capable of handling .tex files with CRLF line breaks while TeXShop.app uses LF as a line ending.

Although I can use other applications like TextWrangle.app to convert text files between the two formats, I really do not want to open an extra window. So I find unix2dox, a command line tool that is developed to “convert text between DOS, UNIX, and Mac formats”. And with Automator, I get a better solution.

  1. Install unix2dos: brew install unix2dos

  2. Create a new service in Automator. Drag a “Run Shell Script” action from the Library and type in the following commands:

for f in "$@"
do 
    unix2dos "$f"
done

Make sure that choose “as argument” for the option “Pass input”.

  1. “unix2dos” will show up in the services when you right click on any text files.