Showing posts with label Mac. Show all posts
Showing posts with label Mac. Show all posts

Tuesday, March 24, 2015

texshop 日本語入力

texshopで背景色を黒にしている場合,日本語入力がまだ未確定の場合,入力している文字が見えなくなるという問題がある.これは良くするためには次のコマンドを使えば良い.

defaults write TeXShop ResetSourceTextColorEachTime YES

しかし,これでバグがでることもあるようなので注意.

参照:
http://pages.uoregon.edu/koch/texshop/version.html

Sunday, September 14, 2014

Remove duplicate entries from launch services

Run the following command as explained here

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

Saturday, April 20, 2013

Apple airplay no sound issue

Sometimes when you mirror your display on airplay you cannot hear. Do the following to solve this issue.

sudo killall coreaudiod

Sunday, August 12, 2012

Reconnect an ejected USB HDD in a Mac

Sometimes you realize that a file that you need is in an external USB HDD that you just ejected. Of course the external USB is still connected to your USB port. So what would you do to make the USB HDD reappear in your connected drives? Of course, you can physically disconnect the external USB HDD and re-plugin it. But that sounds stupid because the device is already connected to your machine. Just open a terminal and first find out what is the number of your disk by,

$ diskutil list

This will list up all your disk. Let us assume the external USB HDD that you want to reconnect is disk1 (by the way your inbuilt HDD will be disk0), do the following,

$ diskutil mountDisk disk1
Thats it! No more physical unplugging and replugging... 

Monday, September 19, 2011

TexShop coloring

From version 3.06 (Lion) it is possible to have different background and foreground colors in TexShop.

You can select the background colors from Preference dialog box. However, other colors must be
specified at command line.

defaults write foreground_R 1
default write foreground_B 1
default write foreground_G 1
will make the font color to white.

The background color can be changed from TexShop Preferences window.

defaults write TexShop commandblue 1
defaults write TexShop commandred 0
defaults write TexShop commandgreen 1
will make the command color to cyan.

To change the cursor color to white do
defaults write TexShop insertionpoint_R 1
defaults write TexShop insertionpoint_G 1
defaults write TexShop insertionpoint_B 1

defaults write TexShop commentred 0
defaults write TexShop commentblue 0
defaults write TexShop commentgreen 1
will make the comment color to lime green.

These are RGB decimal color codes. To obtain those values divide RGB colors from 255.
Here is a list of RGB colors.

TexShop documentation where these color preferences are mentioned can be seen here.

Thursday, April 7, 2011

TexShop MacTex US letter PDFs

By default when you install MacTex and use TexShop for writing and compiling latex you will get PDFs with page size A4. This is all fine for most cases but some conferences require you to submit in US letter format and do not accept A4. This is where the problem begins and all sorts of solutions are proposed on the Web and most require you changing your entire latex configuration to produce US letter size (at least temporary until you revert those changes back to A4). Naturally, I tried those solutions (giving up the hope of finding a solution that can do this paper size change per document basis as it should be and not for the entire latex system) but failed. So I adopted the following command line approach and it works like a charm even without having to modify a single configuration file.

So I thought I would share this solution with the rest of the world.


  1. First things first. Write your document using TexShop (producing A4 size PDFs as it is done by default) and concentrate on the content of the document. At the end of the day that is what matters most. :-)
  2. Now open a Terminal and type the following command to produce a dvi file.
    /usr/texbin/latex mypaper.tex
    Of course, the path to latex (/usr/texbin/latex) depends on your MacTex installation and this is the default installation path. This will produce the 'mypaper.dvi' file.
  3. Now we can convert this dvi to a PDF with suitable page size (US letter in this case) using the following command.
    /usr/texbin/dvipdfm -p letter mypaper.dvi
    This command will produce the 'mypaper.pdf' with the US letter paper size. By the way the dimensions for those two sizes are as follows.
    US letter: 215.9mm x 279.4mm
    A4: 210mm x 297mm source is Wikipedia.
  4. This does the trick! Of course you can also produce a postscript (ps) file if you want to. (Some publishers ask for this one as well.)
    /usr/texbin/dvips -t letter mypaper.dvi -o mypaper.pdf
    Another option to generate a pdf is from this ps file. You can use Acrobat distiller for this purpose. But then why would need to do that when you can do that directly using dvipdfm from the dvi file.
Well, at the end of the day there is no alternative to the power of the command line.... :-)

Additional Note
If you are using pdflatex and do not want to go through the above tex->dvi->pdf routine OR you are compiling with sig-alternate class in the ACM template, creating US letter size PDFs might be difficult.
A good reference is here.
The solution proposed in that reference is to put the following page size modifying lines in the preamble of the document (where you would put \usepackage commands and is prior to \begin{document} is called the preamble in a tex document.).

\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}



This indeed works!

Friday, December 10, 2010

2010 MacBook Air fan speed issue

After copying my data from the 15inch MBP to my new MBA, I found that the fan runs at full speed irrespective of what processes are running. So I decided to reset the System Management Controller (SMC) and this actually helped.

What you must do is switch off MBA while it is still plugged in to the power adapter and press
ctrl+option+shift and the power button (top left corner) just once. The light on the power adapter will
turn into green and after couple of seconds back to orange. Now switch the machine on.

Further info is here

Sunday, June 20, 2010

TexShop

In TexShop to autocomplete a bibliography reference or a label just type some part of the reference and press F5 to get a list of candidates.

Wednesday, May 26, 2010

Mapping keys in Mac

If you want to set things like HOME, END, Japanese RO key to backslash, etc. on MacBook Pro (with the built-in key board or an external Windows keyboard) then use the following software.

KeyReMap4MacBook.

For example, to remap the Underscore(Ro) key to backslash
For Japanese --> Change Underscore(Ro) Key --> Underscore(Ro) to Backslash(\)

Sunday, May 16, 2010

Invalid annotation object error in PDFs

If you used Adobe acrobat to annotate a PDF file and you had Acrobat crashed or had to restart the computer abruptly during the annotation process then you might experience this problem when you reopen the PDF file from Acrobat. Of course if you use Skim or Preview to open the file then you will not get this popup window and everything will display without a problem. To solve this problem first open the PDF under consideration in Preview and then do a save as for the file. You can give the same file name and replace the file. Now everything will work fine.

Saturday, January 2, 2010

Mac Tricks

This post summarizes some useful tips on mac.

1. quick silver.
    start an application.
   option+space.

2. Command+S can save files in almost any application.

3. Command+Option+ESC will bring the force kill box.

4. When Apple Mail hangs with GMail Recovered Mail
     This can happen when you send large messages and something goes wrong.
     The solution is described here
     Delete the hidden directory,    
    ~/Library/Mail/IMAP-@domain.tld@imap.domain.tld/.OfflineCache
    and then delete the 'Recovered Messages' mail folder in Mail.app

5. To hide all windows except for the current window do Command+Alt+H

6. In terminal, open fname will open the fname in the default application. If you want to open with TextEdit do open -a fname.
   

Continuously monitor GPU usage

 For nvidia GPUs do the follwing: nvidia-smi -l 1