If you happen to have an interchangeable set of needles, you can adjust your gauge by switching ONE needle to a different size. Often, our tension is different when we knit vs when we purl.
I've been knitting long enough to know that, in general, I'm a tight knitter. So when a pattern says to use size 6 needles, I automatically start with a 7 or 8.
When I make a swatch, I cast on 26 stitches. All the time, for every swatch. I knit 3 rows for a garter stitch border. Then, I keep 3 edge stitches in garter stitch while working the center 20 in st st. On RS, that means K across, and on the WS, I K3, P20, K3 . After several inches of knitting, I knit 3 rows for a final garter stitch border, BO, wash and block. (okay, sometimes I dont' wash and block, but I usually do).
Measuring is *so* important. Measure in many different places. Measure from garter border to garter border, to the closest 8th of an inch. Then, convert that measurement to a decimal... Here's a cheat sheet:
1/8 = .125
3/8 = .375
5/8 = .625
7/8 = .875
So a measurement of 3 and 5/8ths of an inch = 3.625.
Divide 20 (the number of stitches you have in stockinette) by your measurement (hypothetically 3.625) and you get your stitches per inch, which, in this case is equal to 5.51, or 5 and a half stitches per inch.
Also, if it's a yarn I really really like and use a lot, I keep my swatches. I have swatches made for malabrigo, and I used a permenant marker to write the gauge and needle size I used ON the swatch. So if a pattern calls for 4 stitches per inch, and I want to use malabrigo, I look at my swatches, find the right one, and just pick up those needles and get started. Saves a lot of time!
A lot of people get hung up on "how many stitches do I cast on for 4 inches??" . It doesn't matter. Further, the more stitches you cast on for swatches, the more accurate your gauge is going to be.