Wednesday, December 14, 2011

make[3]: m2c: Command not found

make[3]: m2c: Command not found When I get this error it is usually because I used the wrong flag to put the *.mod files in the mod directory thus creating a bunch of *.mod files in the src directory. Removing the *.mod files from the source directory and using the correct compiler flags usually fixes the problem.

Wednesday, September 21, 2011

Making custom theme for LaTeX

I used the following approach to add a custom beamer theme to a latex presentation that looks like...


Created *.sty file that describes the theme.  Here's mine.
\ProvidesPackage{beamerthemeCTF}
[2008/11/09 v1.0 beamer 'CTF' theme]

\mode

\usebackgroundtemplate{\includegraphics[width=\paperwidth]{CTFLab.pdf}}
\setbeamertemplate{footline}{\vspace{1.2cm}}

\setbeamerfont{author}{size=\large}
\setbeamerfont{date}{size=\large}
\setbeamerfont{example text}{series=\bfseries}
\setbeamerfont{frametitle}{series=\bfseries,size=\large}
\setbeamerfont{framesubtitle}{series=\mdseries,size=\large}
\setbeamerfont{section}{series=\bfseries}
\setbeamerfont{title}{series=\bfseries}

\definecolor{CTFgrey}{RGB}{66,66,66}
\definecolor{CTFlightgrey}{RGB}{175,175,175}
\definecolor{CTFalmostwhite}{RGB}{225,225,225}
\definecolor{CTFred}{RGB}{180,28,27}
\definecolor{CTFtrans}{RGB}{0,0,0}

\setbeamercolor{alerted text}{fg=blue}
\setbeamercolor{block body alerted}{bg=red}
\setbeamercolor{block body}{bg=red}
\setbeamercolor{block body example}{bg=normal text.bg!90!black}
\setbeamercolor{block title alerted}{use={normal text,alerted text},fg=normal text.fg,bg=red}
\setbeamercolor{block title}{bg=blue}
\setbeamercolor{block title example}{use={normal text,example text},fg=example text.fg!75!normal text.fg,bg=red}
\setbeamercolor{fine separation line}{}
\setbeamercolor{frametitle}{fg=CTFred,bg=}
\setbeamercolor{item projected}{fg=black}
\setbeamercolor{normal text}{bg=black,fg=CTFlightgrey}
\setbeamercolor{palette sidebar primary}{use=normal text,fg=normal text.fg}
\setbeamercolor{palette sidebar quaternary}{use=structure,fg=structure.fg}
\setbeamercolor{palette sidebar secondary}{use=structure,fg=structure.fg}
\setbeamercolor{palette sidebar tertiary}{use=normal text,fg=normal text.fg}
\setbeamercolor{section in sidebar}{fg=black}
\setbeamercolor{section in sidebar shaded}{fg= grey}
\setbeamercolor{separation line}{}
\setbeamercolor{sidebar}{bg=red}
\setbeamercolor{sidebar}{parent=palette primary}
\setbeamercolor{structure}{bg=black, fg=green}
\setbeamercolor{subsection in sidebar}{fg=brown}
\setbeamercolor{subsection in sidebar shaded}{fg= grey}
\setbeamercolor{title}{fg=white,bg=}
\setbeamercolor{titlelike}{fg=brown}
\setbeamercolor{itemize item}{fg=CTFred}

\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{headline}{\vspace{0cm}\hspace{0.95\textwidth}\insertframenumber/\inserttotalframenumber\vspace{-9cm}}

\mode

There's some extra stuff in there that I didn't use but wanted to keep all of the color options in the file so I can modify it when I need to do fancy things. :)

Save the file as beamerthemeCTF.sty in ~/Library/texmf/tex/latex/ (you might have to create the folder)

The next step is to put \usetheme{CTF} in your .tex file after \documentclass[mathserif]{beamer}

The last step is to add the background image. Save the picture below as ~/Library/texmf/tex/latex/CTFLab.pdf

Monday, September 12, 2011

Printers/Scanner on Mac

Getting an HP All-in-one printer to print and scan on a Mac caused me a lot of headaches.  I downloaded a variety of drivers and programs from HP hoping to find the magical combination.  I never did.  I did learn that the installers put the drivers in a folder /Library/Printers/hp.  Deleting this folder was useful to start from a clean slate. 

After a lot of searching I found drivers provided by Mac.  They are downloadable from http://support.apple.com/downloads/#hp.  Once I downloaded the drivers, suddenly, the printer and scanner worked at the same time!

Thursday, July 28, 2011

Keep mac from "swooshing" to a different space

Do you ever click on a application in the Dock or do Cmd-Tab to switch applications and suddenly you are whipped to a different space? There's a simple fix that I found here. Just type the commands in a terminal. The first command changes the default swooshing property and the second restarts the dock.

defaults write com.apple.dock workspaces-auto-swoosh -bool NO
killall Dock


Note: if you want to restore the default behavior, run the first command with YES instead of NO. And then killall Dock to restart the dock.

Wednesday, July 27, 2011

ssh and scp easier

Do you ever find yourself typing long commands when using ssh or scp? Something like
  ssh username@DNS-name.edu
or
  scp file username@111.222.33.444:~/file


By modifying your ~/.ssh/config file you can change the two previous commands to
  ssh comp1
and
  scp file comp2:~/file
where comp1 and comp2 are your names for the two computers and can be anything.

All you have to do is add a couple lines to you ~/.ssh/config file and you will save yourself a lot of typing.  The steps below outline the proceedure:
  1. Open ~/.ssh/config in your favorite text editor (you may have to create the file)
  2. For each computer you ssh or scp to add a section to the file that looks like

     Host computer_name
     Hostname 111.222.33.444 (or DNS Name)
     User username
     ForwardX11 yes


    computer_name is what you want to call the compter (comp1 and comp2 in the examples), 111.222.33.444 is the IP address for the remote computer (you can also use the DNS Name), username is the user on the remote computer.
That's it!  Now you can ssh and scp to computer_name with ease.

    Tuesday, July 26, 2011

    Mac: Keyboard shortcut to launch program in current space

    Have you ever wanted to open an internet browser or a terminal to do a small task only to find that OS X sends you to an already open program on a different space.  This was really annoying me so I spent some time figuring out a solution that works great for me.

    We'll start with opening a terminal window because it is easier.
    1. Launch AppleScript Editor
    2. Copy and paste the following code into the editor

      tell application "Terminal"
      do script ""
      activate
      end tell


    3. Save the file as ~/Library/Scripts/Open-Terminal.scpt
    4. Open Finder and go to the ~/Library/Scripts folder
    5. Open Quicksilver (if you do not have it install it from here)
    6. Click the small down arrow and click on Triggers
    7. Click the "+" sign to add a new HotKey
    8. Drag Open-Firefox.scpt from the Finder window into the window that opens
    9. Click on the Trigger column to change the Hot Key (shortcut key)
    10. Now when you press the Hot Key a new Terminal window should appear on whatever space you are currently on and open redirect.html which instantly loads www.google.com
    For Firefox
    1. Launch AppleScript Editor
    2. Copy and paste the following code into the editor

      tell application "Firefox"
          open "~/Library/Scripts/redirect.html"
          activate
      end tell


      this code tells Firefox to open and go to redirect.html
    3. Save the file as ~/Library/Scripts/Open-Firefox.scpt
    4. Open Finder and go to the ~/Library/Scripts folder
    5. Create ~/Library/Scripts/redirect.html in a text editor and paste the following code into the file

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <html>
      <head>
      <title>Redirecting</title>
      <meta http-equiv="REFRESH" content="0;url=http://www.google.com"></HEAD>
      <BODY>
      <p> Redirecting </p>
      </BODY>
      </HTML>
    6. Open Quicksilver (if you do not have it install it from here)
    7. Click the small down arrow and click on Triggers
    8. Click the "+" sign to add a new HotKey
    9. Drag Open-Terminal.scpt from the Finder window into the window that opens
    10. Click on the Trigger column to change the Hot Key (shortcut key)
    11. Now when you press the Hot Key a new Firefox window should appear on whatever space you are currently on