happenings — latex

Edits: Feb 2.
removed “a” from codes for bold and strong in HTML; and I just noticed that the LateX for color and for size does not display when you hold the mouse over it.

(This wasn’t the first post I intended to put out after the long layoff, but it’s the one that is ready, so here it is. I’ve got a couple in the works, and I hope that one will be ready for Wednesday.)

This post shows a lot of the HTML and the LaTeX that I use.

I keep a draft post for testing HTML and latex. I’ve decided to clean it up and post it, so that other people can see how I do this. Oh, one reason for using my own HTML is that we need to use the HTML tab rather than the visual tab. About the only thing I let WordPress do for me is add a link. (Actually, in the course of typing this, I have gotten used to using the WordPress “bold” button.)

I keep a text file of just about everything I’ve ever used in a post, so I can copy-and-paste. In other words, my draft post is used for testing new things, but I didn’t bother throwing out all the old things after they worked. The equations involving square brackets ended up in here in response to a question in the forums. (And that question and answer, truth be told, was my fundamental motivation for posting this.)

Note that HTML and latex behave differently.

If you want to know what latex created a particular equation, all you have to do is hold the mouse cursor over it: WordPress will display the latex. On the other hand, I don’t want to have to search my own posts to find out how I got, for example, the double dot for acceleration.

As far as I can tell, however, the HTML does not display when you hold the cursor over it. You may know HTML, and you may not need to see any of these, but I pretty much learned what HTML and latex I know in the course of the past year.

Only because my HTML entries occur first, let’s look at the HTML that I use. Oh, I have to show you another trick.

How can we display code in a post? Easy enough.The reference is
here. This will tell us how to display HTML code. Oh, but how do I show you the code one level up?

Here is a picture of the code which displayed the HTML code:

sourcecode

Here are the HTML examples

Italic:
how complicated is this?

how <em>complicated</em> is this?

(That is, the preceding little box is the output of that “sourcecode” stuff.)

Bold (two ways):
now, strong words.
now, bold words.

now, <strong>strong words</strong>.
now, <b>bold words</b>.

centered:

what gets me centered?

<p style="text-align:center;">what gets me centered?</p>

Aligned right:

on the right?

<p style="text-align:right;">on the right?</p>

A small heading:

how about a small heading?

<h2>how about a small heading?</h2>

Colored text:
and what about color?

<span style="color:#ff0000;">and what about color?</span>

strike-out:
and this?

<span style="text-decoration:line-through;">and this?</span>

underline:
I mean this.

<span style="text-decoration:underline;">I mean this.</span>

an ordered list:

  1. yaba
  2. daba
  3. do
<ol>
	<li>yaba</li>
	<li>daba</li>
	<li>do </li>
</ol>


an unordered list:

  • yaba
  • daba
  • do
<ul>
	<li>yaba</li>
	<li>daba</li>
	<li>do </li>
</ul>

Here are the latex examples that i still have in here

As I said, to see the latex, just hold the cursor over the equation or symbol. By the way, I have one very nice but very expensive resource for latex: there is a command in Mathematica (//TeXForm) which produces TeX output. It isn’t perfect, but its failures are very rare.

a vector cross product
v_f = v_r + \omega\ \times\ r

acceleration
\ddot{g}

set intersection and ^
\hat{A} \cap \hat{B} = \phi\

implication
T21/2 \Rightarrow T2 \ .

not an element
x \notin A

foreground and background colors for an equation! I just found this and have not used it for real, yet. And for these commands, I have to show the code myself: here is the code without the dollar signs:

latex How’s this?&bg=ffcccc&fg=cc00ff

How's this?

bigger equations
latex { [plain\ text] }&s=4

{ [plain\ text] }

By the way, the curly braces are essential outside the square-bracketed stuff. See below.

to get parentheses of appropriate size
a_f = a_r + 2 \omega\ \times\ v_r + \omega\ \times \left(\frac{A}{B} \right)

to get square brackets of appropriate size
a_f = a_r + 2 \omega\ \times\ v_r + \omega\ \times \left[\frac{A}{B} \right]

Since it may be difficult to see, let me say that just as we used \left( and \right) to get parentheses of the appropriate size, so we use \left[ and \right] to get square brackets of the appropriate size.

I have also discovered that if I simply want square brackets in latex, I have to put the expression in curly braces. That is, the following works, although the brackets have not been sized nicely (the \left and \right are gone):

a_f = a_r + 2 \omega\ \times\ v_r + \omega\ \times {[\frac{A}{B} ]}

in contrast to using parentheses. To write the same expression using parentheses, we do not need curly braces; as before, plain parentheses are not sized nicely:

a_f = a_r + 2 \omega\ \times\ v_r + \omega\ \times (\frac{A}{B} )

an alternative display of a matrix. (Again, I haven’t used this yet, and since Mathematica creates usable latex for this, I have no reason to use this; perhaps you do.)
\begin{pmatrix}x'\\ y'\\ z'\\ w'\end{pmatrix}=\begin{pmatrix}1&0&0&0\\ 0&1&0&0\\ 0&0&\cos\theta&-\sin\theta\\ 0&0&\sin\theta&\cos\theta\end{pmatrix}\begin{pmatrix}x\\ y\\ z\\ w\end{pmatrix}

About these ads

3 Responses to “happenings — latex”

  1. Edward Says:

    Thank you for the LaTex samples. I can not for the love of money display a simple product, for example, of n primes each labed p subscript i. I have been trying variations of the following without success: \p_1p_2\dotsm
    The dotsm work,but not the letters p nor variables such as x or y. I do not know if the problem is 1.)me 2.)wordpress 3.)other.

  2. rip Says:

    Hi Edward,

    I know how frustrating it can be to track something down. I made two changes: drop the backslash in front of p1, put a space after the 1.

    I expect that this code will not work in a comment, but I have checked it. Perhaps more importantly, this is a copy-and-paste of what worked for me.

    p_1 p_2\dotsm

    Rip

  3. rip Says:

    Hey, it worked!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 49 other followers

%d bloggers like this: