Sunday, July 5, 2015

upgrading to the newest TeXnicCenter

I've been using ShareLaTeX online, so I haven't had to open up TeXnicCenter recently. But today I had to update the bibliography, and AGU doesn't want a separate .bib or .bbl file, they just want all of the references pasted into the main file. I don't know how to do that on ShareLaTeX - they advocate using some newfangled BibLaTeX thing, but I didn't see how that would create a .bbl or have anything I could paste into the main file.

Therefore, I went to see about updating my TeXnicCenter so I could do it the old school way. Sure enough, there was a new release, 2.02. I installed it, and tried to remember how to create the .bbl file.

After some failure, I found the following information online:

In order to correctly Build the file, you also have to install GhostScript (I already had MikTeX on my computer.)

When I restarted TeXnicCenter after installing GhostScript, a wizard guided me through setting things up. I mostly hit the defaults, but set the PS viewer as the newly installed GhostScript executable.

Then when I hit Build, it ran LaTeX, then BibTeX, then rerun these a couple times (I never know why you need to re-run them, but the number of errors goes down.)

Then I pasted the .bbl output into the main file, and I can go on my way editing in ShareLaTeX with the updated Bibliography.

There must be a better way.

Stuff I needed when running BibTex:
%\bibliography{BibTeX/erosion}
%\bibliographystyle{BibTeX/agufull08}

I still use JabRef to organize the bibliography.

All of my files are backed up in DropBox and synced with ShareLaTeX so I feel pretty good about that.

Wednesday, April 15, 2015

plot.ly and matlab

There's some crazy stuff on the internet these days.

I wanted to make an interactive plot for one of my figures that is hard to fully grasp. I remembered the plot.ly software and of course they have added a lot of new stuff since I've last looked. Such as converting matlab figures to plotly.

https://plot.ly/matlab/getting-started/

Which resulted in these abominations.

https://plot.ly/~hsu.leslie/8  (default styling)

https://plot.ly/~hsu.leslie/10  (supposedly my original styling)

Looks like it could be really cool if used properly. Still some conversion issues obviously.

Hope someone I now figures it out and shows me what to do.

Sunday, October 26, 2014

Writing text output of a table

    % open file, write out header
    % write out transpose of table4, with six total places per column, two decimal places (or none for npts)

    fileID = fopen('table4.txt','w');
    fprintf(fileID,'%6s %6s %6s %6s %6s %6s \n',
            'a', 'b1', 'b2', 'R^2', 
            'rmse', 'npts');
    fprintf(fileID,'%6.2f %6.2f %6.2f %6.2f 
            %6.2f %6.0f \n',table4');
    fclose(fileID);

Monday, July 28, 2014

extracting odd-shaped parts of figures

I have some photos of instruments, but there is a lot of stuff in the background cluttering up the photo. I want to crop out the instruments and arrange them in a single figure.


  1. Import the figure at high resolution into photoshop
  2. In the layer dialog drag the layer down to the bottom (the icon for creating a new later) to create a copy of the layer.
  3. Make a layer in the middle of the two layers and Fill it with white in the background - when you crop out the image, you want a white background, but if the original image is in the background you won't get that.)
  4. Use the Lasso tool, "L" to outline the shape you want to keep. You can click "enter" to complete the polygon.
  5. cmd-shift-I to invert to select the area around the shape.
  6. Delete to remove the area around the shape.
  7. Save as a jpg.


vs.

photos from M. Tivey




Monday, May 19, 2014

mac vs. pc matlab continued

Might have more posts here soon since I just agreed to be a guinea pig for a software documentation project and they already picked apart my first very simple script for not being componentized, not cross platform, and has lots of runtime dependencies.

From stack overflow. Actual functions to make code cross-platform.

Of course, if you try to access a Windows-style path on a Mac, it will error.
MATLAB includes a set of functions that make it fairly easy to make your code cross-platform with respect to these sorts of issues. Take a look at, for example, the functions fullfilefilepartsfileseppathsepispc, and ismac.

Tuesday, February 4, 2014

crop in illustrator

From klf:
Something for mat-illustrator-labor wot I just learned here (http://forums.adobe.com/thread/319423):

You know how you can crop things really easily in Photoshop but not in Illustrator?  This is a huge pain for figures with a lot of white space that you want to get rid of before submitting the figures for publication (e.g., for Matlab figures imported into Illustrator).  Here's a workaround in Illustrator that'll let you do what cropping does.

1. Open your big figure.  This figure includes some stuff you want to keep (e.g., data) and some stuff you want to get rid of (e.g., white space).
2. Create a shape on top of the figure the size and shape of the area you'd like to crop.  E.g., a rectangle.  Place it right over the stuff you want to keep.
3. Color that rectangle some color (e.g., white).  Doesn't matter what color.  Just make it something you can see.
4. Use the transparency palette to set the opacity of the rectangle to 0%.
5. Select the rectangle and the underlying figure.
6. Click on Object > Flatten transparency.  (Use 100% vector on the quality slider, and make sure the "Preserve alpha channel" box is unchecked.)
7. Ungroup the result.
8. Click on the things outside the rectangle and delete them.  Done!

Tuesday, January 7, 2014

compress a PDF online

http://compress.smallpdf.com/

Just compressed a 21 MB to 2 MB. Original pptx was 6 MB. Random.