# Automatically Centered Images

I like it when the images in posts are centered because for me the whole post looks a little bit more professional.

Therefore I use currently the hskip command:

$\hskipXin$     % with X being some real value, e.g., .5, 1, 2, ...


But doing this all the time manually, which includes the need to find a proper X-value that somehow centers the image, isn't that satisfying. ^^

Theoretically, can you tell which method I would choose to automagically center my images?

@MartijnPieters Can you please tell how to align it center

@SVM-RAJESH: you cannot; there are no alignment options.

So, you have no official way of doing this. Instead;

• Use \hspace or \hskipxin. I prefer \hspace though. It would've been heaven if MathJax supported \rule - that really gives horizontal and vertical control over "stuff" - but no cigar.
• Use <pre>. This is inconsistent and/or ugly in some browsers.
• Use &nbsp;. Ten times a day, before each meal. Well, I'm pretty sure we're lazier off with $\LaTeX$ shortcuts.

Now, let's resize this thing:

## Using \hspace:

$\hspace{25ex}$

I used $\hspace{25ex}$; then stared at the image to figure out whether if it's centered or not$\ldots$ and then felt asleep. So figuring that out is your job.

## Using <pre>





I typed 25 spaces to achieve that. If we're too lazy for \hskipxin, then yeah$\ldots$ this isn't an option.

## Using &nbsp;

I don't have much to say, just that I used 48 &nbsp;s to align it like that.

So it's your choice which one to use.

• As an alternative, you can make you pictures full width. Of course this is only possible, when you make original content or decide to resize sources from the internet. – Martin - マーチン Aug 4 '15 at 23:46
• On another note, I took a look at this answer from my android tablet's browser; the only one that actually looked centered was the \hspace version. Talk about inconsistency$\ldots$ – M.A.R. Aug 5 '15 at 8:33