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.

Saturday, December 28, 2013

Germanic or something

matlabor lives.

On to a new topic of writing and manuscript reviews:

An example for me to remember from bd:

It is a matter of writing style- but I have never liked the “we must understand” language.  Rather than talking about “must do” just do it.  If you tell us the why’s you don’t need the ‘must’ and it seems so…. Germanic or something.  You use this kind of statement in each of your paragraphs.

Sliding and impact erosion both contribute to total erosion, so to predict bedrock incision rates by granular flows, we must understand the controls on mean and fluctuating boundary forces.

My alternative—no “must”- it is implied and something more is stated:

In natural granular flows in which heterogeneous grain sizes are mixed with a viscous matrix, both sliding and impact erosion likely contribute to bedrock erosion.

No Germanic fist pounding—still new information coming in.  Try it out- it’s fun…

****

I shall try, I shall try...

Saturday, September 28, 2013

adding arrowheads to lines

A long-standing source of frustration is adding arrowheads to lines just the way I want, or making a "nicer" looking arrow.

Here is an article
http://luanneseymour.wordpress.com/2012/10/30/creating-arrows-and-arrowheads-in-illustrator-cs6/


Sunday, April 28, 2013

more illustrator tips


- Select more than one item, ctrl-J to join
- Use layers, make a layer for the fill, highlight something then drag the colored square from one layer to another. lock and view layers.
- AV: shortcut for black arrow
- A: arrow for white arrow
- P: shortcut for pen, bezier pen, add or remove points, hold for menu
-T: shortcut for text
- gradient tool, draw line in the direction of gradient, adjust top, bottom, and middle handles; view gradient menu to change from linear to radial. Need to have gradient swatch/swath available.
- To sub-script, need to click on the menu and "more options" in the character window

Thursday, February 28, 2013

dictation

This web app will take your dictation

http://ctrlq.org/dictation/

Saturday, January 12, 2013

scalebox

You have a table for LaTeX and it is too large for your page, even when you use landscape. Annoying!

Use scalebox

\scalebox{0.7}{
  \begin{tabular}...
  \end{tabular}
} 


more info: http://en.wikibooks.org/wiki/LaTeX/Tables

Saturday, November 17, 2012

subaxis

subaxis allows you to adjust the spacing in a subplot. Use subaxis instead of subplot.

% To fill the first column of a 4 by 3 plot:

h = subaxis(4,3,(i*3-2), 'Spacing', 0.045);

Monday, October 29, 2012

rounded buttons

Say you want some rounded buttons on a webpage, and you make your buttons in Powerpoint because you don't know what else to do. You may run in to problems for cropping those rounded buttons because most crop programs make only exact rectangles.

Here is a solution:

  1. Make the buttons in Powerpoint (or Illustrator)
  2. If you made them in powerpoint, screenshot a high resolution version (I did this from opening a PDF saved from the Powerpoint in Illustrator.)
  3. Open screenshot in Photoshop. (mine was a .png)
  4. Press "C" to open the crop tool and crop close in to the button, then press "return" to crop.
  5. If your button is outlined, press "W" for the wand tool and click to outline the surrounding area outside the button.
  6. With the outside area highlighted, press "delete"
  7. Save for a web device, GIF, transparency "background color" (this will make the area around the button transparent so you can have rounded buttons)
Here's an example of the result:

remove unwanted link underlining

Some website templates will automatically underline any links you have, even image links, which is a little unsightly.

You can get rid of it by surrounding the image with a div style tag:

<div style="text-decoration: none;"> </div>

And to display greater than or less than signs in html (like above) you can use &lt; and &gt;

Monday, October 22, 2012

TeX stack exchange

What are all of these sites, too many to keep track of:

http://tex.stackexchange.com/

This is a collaboratively edited question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Posts 4, 12, 18, 18, and 19 minutes ago...

Thursday, October 4, 2012

software carpentry

This site is designed to "help scientists be more productive by teaching them basic computing skills."

http://software-carpentry.org/

It looks potentially super useful. There are MATLAB, python, and versioning sections, among many others.

Saturday, September 8, 2012

figures in latex

Q: I want to put a figure into a latex document. I am trying things, but the image is not appearing when I compile it.

A: You need to use:
 \usepackage[pdftex]{graphicx} instead of
\usepackage[dvips]{graphicx}.

[klf]

Monday, August 13, 2012

shading flat

plot without mesh lines:


shading flat;  % remove the black mesh lines



Saturday, August 4, 2012

histc, histogram count

http://www.mathworks.com/help/techdoc/ref/histc.html

n = histc(x,edges) counts the number of values in vector x that fall between the elements in the edges vector (which must contain monotonically nondecreasing values). n is a length(edges) vector containing these counts

Very useful. Plot histogram points instead of bar graph. Need to calculate bin centers and use as x values. Divide the result of histc by the length(x) to get the y values. Plot.