Word中创建数学公式的方法

简介:

https://uwaterloo.ca/information-systems-technology/services/scientific-computing-software-support/supported-software-scientific-computing/creating-and-numbering-equations-microsoft-word-2007


Creating and numbering equations with Microsoft Word 2007

Microsoft (MS) Word 2007 has a built-in equation editor which is now the default when you create equations. The equation editor is only available in Word 2007 and not Excel, Powerpoint or other applications.

Microsoft Equation 3.0, the default equation editor in previous versions, is still available and can also be used in Excel, PowerPoint, or any application that supports Object Linking and Embedding (OLE). See the course notes on using Microsoft Word '97 for the old equation editor for more information.

Comparison of options for equation editing

Feature Office 2007 built-in equation editor Microsoft Equation 3.0
(old version)
Ease of use Very intuitive, "builds-up" equations as you type

Not as intuitive, steeper learning curve

Keyboard shortcuts

Standard math and LaTeX symbols work

Custom (e.g., Ctrl-H for superscript)
Display equations Display equations can't be on the same line as other text Able to use tabs on same line as display equations
Equation numbering

Need to use tables to create equation numbers

Adding equation numbers is simpler

Rendering Very high quality Moderate quality
Interoperability Not accepted by some journals, no workarounds! Commonly used and interoperable

When not to use the Office 2007 equation editor

When you convert a document that includes Office 2007 equations to the old ".doc" format, the equations are turned into graphics. They are visible, but not editable. We recommend that you do not use the Office 2007 Equation Editor if:

  • You need to submit to a journal that does not accept Office 2007 .docx files

  • You need to collaborate with people who do not have Office 2007

  • You use Office 2007 in Compatibility Mode (.doc files)

In these situations, the recipients of your documents will not be able to edit the equations. This would make collaboration difficult, and in the case of journals, would make submission problematic and revision impossible.

Why use the Office 2007 equation editor

Word 2007's method of entering equations from the keyboard and building up equations is more natural, intuitive and efficient than earlier approaches to typesetting equations. Word's internal representation of the equations resembles mathematics, and is much more readable.

By comparison the MS Equation Editor approach takes a visual rather than mathematical approach. A markup language like LaTeX remains the best choice for complicated documents and for overall typesetting quality, yet the source code for an equation in LaTeX rarely looks like math.

How Office 2007's equation editor "builds-up" equations

The new Office 2007 equation editor works in a different way than the old equation editor. It uses the AutoCorrect feature of MS Word to do some of the formatting, and it introduces a concept of "Linear" vs. "Professional" formats. Linear format is what you might use in a programming language to write mathematics: e.g., y = (a*x+b)/(x^2+1).

As you type an equation, Word converts it on the fly (Microsoft calls this "building up") into professional format. In order to use the equation editor efficiently, you will need to get used to how Word builds up equations. A good way to learn is to carefully watch what happens on screen as you push each key.

Some symbols are inserted automatically by Word as you type using AutoCorrect. And some formatting is applied as you type. The rule is that the equation is built up when you type any character than makes what you've typed so far unambigious. As a result, AutoCorrect and building up are only triggered by certain keys. The spacebar always builds up and triggers autocorrect, and using it is a good way to force Word 2007 to interpret what you've typed so far.

Learning how to use the equation editor

To insert an equation in a Word 2007 document, click on the "Insert" menu/tab to see the "Insert" ribbon. In the "Symbols" section, choose "Equation". You can also press "Alt+=" on your keyboard.

Insert menu button

Insert symbol section

You will now see Equation Tools | Design Ribbon. There are three main sections.

Tools

Equation gallery under Tools section

In the "Tools" section you have access to the "Equation" gallery, and you can select "Professional", "Linear" or "Normal Text" modes. Professional format is rendered two-dimensional math, as you would write on paper or a blackboard. Linear format is the equation editor's internal format. Normal text is for non-mathematical text annotations within an equation.

Professional format: Equation displaying as 'professional format'

Linear format: Equation displaying as 'linear format'

Notice that linear format has redundant brackets to make the mathematical interpretation unambiguous. When the equation is formatted, Word automatically removes these brackets. The square root symbol is a single character, and its operand is the bracketed expression immediately following the square root character. You can force Word to show an expression in brackets by using two sets of brackets around the expression.

Symbols

Symbols gallery

The symbols section contains commonly-used mathematical symbols. You can use the two scroll buttons to see more, or click the 'more' icon icon to view all of the "Basic Math" symbols. Then click on "Basic Math" to see other sections of symbols:

  1. Basic math

  2. Greek letters

  3. Letter-like symbols

  4. Operators

  5. Arrows

  6. Negated relations

  7. Scripts

  8. Geometry

Exercise

Insert an equation, explore the symbol palettes and find symbols that you will need in your manuscripts.

Structures

Structures gallery

The "Structures" section contains the formatting tools you will use to create equations. Each section contains 'structures' which are like a template with one or more symbols, and one or more placeholders for you to place your mathematical content into.

For example, to create a fraction, choose "Fraction" then the first template. You will see a fraction where the numerator and denominator are both boxes with dotted lines. You will place your content in the place of these boxes.

The "Matrix" structures are not only useful for true matrices and arrays, but can also be used to align certain types of equations and to place notes in and around equations.

Examples of structures

The integral menu contains indefinite, definite, double and triple integrals. There will be a placeholder for the integrand. Definite integrals also include placeholders for the upper and lower limits of integration.

Example of a structure

More complicated expressions can be constructed by having structures inside of other structures, for example:

Example of structure inside other structure

The right hand side of the above equations consists of a "Bracket" structure. Inside the bracket's placeholder is a 3x2 matrix. In order for this to look right, the matrix has been modified for left alignment of the second column, and the word "if" has been changed to "Normal text".

Keyboard entry of equations

Standard characters that are on your keyboard you will type directly into the equation editor. The equation editor also recognizes many conventions for typing math:

Keyboard Result
^ Superscript
_ Subscript
/

Fraction

() {} [] Standard brackets
<, >

Inequalities

<=, >= Converted to standard less/greater than or equal to

In addition, there are a number of symbols that can be entered by typing backslash "\" and the name of the character. (These are mainly based on LaTeX codes.)

Keyboard Description Example
\alpha \beta \gamma \delta

Greek Letters

Αβγδ
\Alpha \Beta \Gamma \Delta Uppercase Greek Letters

ΑΒΓΔ

\pm or +- Plus/Minus symbol ±
\sqrt(x) \sqrt(n&x) Square root, nth root

√, nth root symbol

\le or <= Less than or equal to

\sum \prod

Sum, product

∑, ∏

\int Integration symbol

\times Multiplication x
\ominus \oplus \otimes Operators in circles

\equiv Congruent symbol
\approx Approximately equal to
\in Element of set

As you type, the equation editor converts recognized symbols to the corresponding graphical characters. This conversion happens as soon as you've typed enough to make the math unambiguous. You can trigger an update by pressing the space bar. You can also choose "Professional" format to force the equation editor to render and interpret what you've typed so far.

Putting an equation button on the tool bar

If you are entering many equations, you may find it convenient to have an "Insert Equation" button right on the "Quick Access Toolbar".

  1. Click on the arrow to the right of the "Quick Access Toolbar"

Arrow to the right of the Quick Access Toolbar

  1. Choose "More Commands..."

  2. Under "Choose commands from", select "Insert Tab", choose "Equation" from the list and click "Add"

Adding 'equation' to the toolbar

  1. Click "OK".

Moving around the equation

The cursor indicates where you are about to enter information on the equation. The equation editor highlights the region of the formula in which you are working, e.g. the placeholder of a bracket, a superscript, a numerator/denominator of a fraction. You can set the insertion point by clicking with the mouse, or with the keyboard. You can use the left arrow and right arrow keys to move through the equation. For more advanced editing, can you change the equation to "Linear Mode", make corrections, then switch back to "Professional Mode".

Exercise

Enter the equation:

Quadratic equation

Method 1

Start the equation editor (Insert | Symbols | Equation or ALT+=) and:

  1. Type "x=" from the keyboard

  2. Choose a fraction from Structures | Fraction

  3. Click on the numerator, type -b from the keyboard

  4. Select "plus or minus" from the Symbols ribbon

  5. Select a radical from Structures | Radical

  6. Click in the placeholder

  7. Type b from the keyboard

  8. Select "b"

  9. Select a superscript from the Script palette

  10. Select the superscript, Type "2" from the keyboard

  11. Press the right arrow to come down a level, and type "-4ac"

  12. Click the denominator (or press the right arrow twice) Type 2a

Method 2: Keyboard entry

Tip: You can use extra brackets to show Word how to interpret what you type.

Type "x=(-b+-\sqrt(b^2-4ac))/2a"

Notice:

  1. When you type the second "\" Word replaces +- with the plus or minus symbol. You could also type \pm.

  2. When you type the second "(" Word replace \sqrt with the square root symbol.

  3. When you type "-4ac" Word turns "^2" into a superscript.

  4. When you type the SECOND ")" Word expands the square root.

  5. Word automatically hides redundant parentheses, we entered these to show Word how to format the equation.

  6. Word puts "2a" in the denominator even though this is ambiguous the way we typed it.

Method 3: "Cheating"

Click on the Equation button, and you will find that the quadratic formula is available as a Building Block in the Equation Gallery. You can save your own equations to the Equation Gallery so that you will only have to typeset them once.

Deleting from equations

As you are entering the equation, you can backspace at any time. You can also select parts of the equation with the mouse, and delete.

Growing brackets

Brackets, parentheses and braces will automatically grow with the enclosed text. You can toggle this behave by right-clicking in the placeholder section of a bracket, and choose "Stretch Brackets".

Exercise: Typeset a continued fraction

Example of a continued fraction

(To enter the above continued fraction from the keyboard, you can type: "1/(2+3/(4+5/(6+7/(8+9/10))))" then press the spacebar to format the final fraction.)

Matrices

Matrices of any size can be created from the Matrix section of the Structures ribbon. Once you have inserted a Matrix, you will be able to right click on it to add or delete columns and rows. You can also change the alignment settings for the rows and columns.

Exercise: Typeset a 4x4 matrix in square brackets

There is a built-in option for a matrix surrounded by square brackets. It is also possible to add the square brackets to an existing matrix.

Matrix surrounded by square brackets

Exercise: Format the matrix

Once you've created a matrix, you can right-click inside it to access spacing settings. These allow you to adjust the overall positioning of the matrix and the row and column spacing. You can also access settings for alignment of rows and columns.

Aligning at the equal sign character

When you are typing a derivation, you may want to show a calculation with your equals signs lining up. Compare Word's default of centering:

Example of equation with default centering

to the more standard view:

Equation algined by equal sign character

Exercise: Typeset a calculation aligned at the equals sign

  1. Create an equation (Insert | Equation) or Alt+=

  2. Type y=(x-1)(x+1)(x^2+1)

  3. Press Shift-Enter (this tells Word to create a new line, but to group it with the current equation)

  4. Type y=(x^2-1)(x^2+1)

  5. Press Shift+Enter

  6. Type =(x^4-1)

  7. Your equations are now being centered as a group, but they are aligned on the left

  8. Select the equals sign (=) in each equation, right click and choose "Align at this character"

Aligning a set of equations

In system of several variables, you may have several equations in the same variables and want the coefficients lined up:

Example of a set of equations aligned at equal sign character

At this time, there is no way to create an equation array from the menu interface. You would not want to use a matrix for this type of alignment, because it would be difficult to get the spacing right. In addition, an equation array automatically aligns at the equals signs. Here is how to create an equation array using the keyboard:

  1. Create an equation (Insert | Equation) or ALT+=

  2. Type \eqarray

  3. Type (2&x + &3&y + &&z = &10& @

  4. Type 4&x + &&y -&&z = &3& @

  5. Type &x + &10&y+&&z = &25&)

  6. Press spacebar

How this works

The \eqarray symbol tells Word that this is an equation array. Everything in the brackets that follows it the equation array. A new row is started with @. The & symbols are used to line up the equation. The & before a number tells Word to insert space at that position if necessary. The & after the number is the alignment point. The first, third, fifth, and every odd ampersand is an alignment point. Each even ampersand is a spacer where Word can add space to line up the equations.

Functions

Properly typeset function names should be in roman text (not italic). Word has a built-in list of recognized functions and will make this change automatically for these. If you use other function names, you can manually change them to "Normal text" or add them to Word's list of recognized functions. In the piecewise function definition above, we manually changed "if" to normal text. But you would never have a variable called "if". Here's how you add "if" to Word's list of functions.

  1. Click on an equation to display the Equation Tools | Design ribbon.

  2. In the Tools section, click the small arrow pointing down and to the right.

Arrow icon in Tools ribbon

  1. Click on Recognized Function

  2. Type "if" and click Add

  3. Click OK on each window to return to your document

Editing an existing equation from a legacy document

"Microsoft Office Word 2007 includes built-in support for writing and editing equations. Previous versions used the Microsoft Equation 3.0 add-in or the Math Type add-in. Equation 3.0 was included in previous versions of Word and is available in Office Word 2007. Math Type was not included in previous versions of Word but was available for purchase. If an equation was written in a previous version of Word and you want to edit the equation by using Office Word 2007, you need to use the add-in that was used to write the equation. If you purchased Math Type, you need to have Math Type installed." (from Microsoft Word 2007's help)

An existing equation can be edited either by double clicking on it, or by right clicking on it and selecting Equation Object, and either Open or Edit.

Positioning of equations

Equations can appear in-line Sample equation in a line of text. The line spacing will adjust accordingly (and will likely look better than in this web-based example). If you wish to have equations appear in a paragraph by themselves, simply press Return before and after the equation.

To align an equation, click on the equation to select it, click on the equation menu, and choose the appropriate alignment under Justification. You can also choose either "Change to Inline" or "Change to Display" to change the equation's size and display position.

Display equations in Word 2007 cannot have any other text on the same line. If you add text to the line containing your equation, Word 2007 will automatically change it to an inline equation. In most cases, you do not want this, it will make your equations too small, especially if they contain complicated fractions or subscripts.

This makes numbering equations in Word 2007 more complicated than in previous versions, and the common practice of numbering equations on the right hand side requires a workaround.

Numbering equations

Equations to be numbered are usually centered with the number at the right margin. Word 2007 does not have built-in support for equation numbering, and at this time, we do not have a preferred solution.

What follows is a method of using tables suggested by Microsoft developers, but it is not perfect. There are also equation numbering macros available from a member of Microsoft Research, however they are unofficial and not supported by Microsoft.

Because of these limitations, we highly recommend that you check with your thesis supervisor, department, and any journals you are planning to submit to and determine what formatting will be required. You will want to ensure that you have set this up in Word before you start typesetting your work.

Equation numbering using tables

One technique is suggested by Jennifer Michelstein in a Microsoft blog.

In this approach, you create a 3x1 table, with the middle (2nd) column wide and centered. The equation goes in the middle column, and the equation number goes in the the right-most column. To use chapter numbers in your equation numbers with this technique, you will need to manually update the numbering at the beginning of each chapter.

  1. Insert a table with 3 columns and 1 row.

Insert table button

  1. Click in the rightmost cell in your table. In Table Tools | Layout | Cell Size, click the dialog launcher icon to open Table Properties:

Dialog launcher icon to open Table Properties

  1. In Table, set Preferred width to 100%.

  2. In Column set width to 15%70% and 15% for columns 1, 2, and 3.

  3. In the Cell tab (for the rightmost cell) set vertical alignment to Center.

  4. Click OK and select your table.

  5. In Table Tools | Design, click the arrow for Borders then No Border.

  6. Click in the rightmost cell. In the Home Ribbon, click the arrow for lists, and choose Define new Multilevel List:

Define new multilevel list option

  1. Add brackets to the formatting string for level 1. This will be the format for equation numbers without chapter numbers. For equation numbers with chapter numbers, select level 2 and select Include level number from Level 1.

Setting equation numbers with chapter numbers

  1. Now add a period between the 1 and the a and insert an open bracket at the beginning.Then change Number style to 1, 2, 3... (Leaving the "a" in place lets you see the difference between the numbers for levels 1 and 2.)

Equation number formatting option box

  1. If necessary, change the List Level for your number to include or not include the chapter number.Right-click on the number, choose Numbering, then Change List Level then select the appropriate format.

Change list level options

  1. Click in the middle cell of your table and insert an equation (ALT+=).

  2. Select your table, and choose the Equation menu, then Save Selection to Equation Gallery:

Equation gallery button

  1. Give your equation a name (e.g. Numbered Equation), under Category choose Create New Category and provide a name starting with AAA. (This makes your equation show up first, the category has to be alphabetically before "Built-in". Click OK.

  2. Now to insert a numbered equation, click on the equation button and choose Numbered Equation from the menu.

Insert numbered equation option

  1. If you include the chapter numbers in your equation numbers, you will need to update these manually. At the first equation number in a new chapter, right click on the equation number and choose Set Numbering Value. Click on Continue from previous list and check off Advance value. Then you will be able to set the value for both the chapter number and the equation number.

Set numbering value option box

Equation numbering using macros that create tables

Another technique comes from Dong Yu of Microsoft Research. He has developed macros for equation numbering that create 2x1 tables with a tab in the first column to align the equations. You can choose whether to number with or without chapter numbers. There is also a mechanism to include a chapter increase indicator with your chapter headings so that chapter numbers increase properly. These methods should make equation numbering mostly automatic.

Although these macros come from someone who works at Microsoft Research, they are not an official feature, so are not supported and may not work in future versions or updates of Office 2007. You should only use them if you are familiar with macros and have the confidence and ability to modify them to suit your needs.

Cross referencing an equation

You may wish to create a cross reference to an equation, a statement in your document such as "As was shown in Equation 3..." While you could enter the equation number as text, this will quickly become out of date as you edit your document. You want Word to insert the appropriate equation number, and update it if the number of the equation should change.

At first glance it would appear that you could do an Insert, Cross-reference and select "Equation" as the reference type. However, this will only work if you let Word caption your equations, and Word will only caption an equation above or below the equation, which is not standard formatting.

You will need to use a Bookmark to reference the equation number.

Bookmarking an equation number

Click on the equation number to select it, then issue the command Insert, Bookmark. Insert bookmark on equatio number option box

  1. Assign a meaningful name to the Bookmark (bookmark names should start with a letter and should not include any spaces), and click Add. Repeat this process for any equation that you wish to reference.

Creating the cross reference

  1. To create a cross reference to the equation somewhere in your text, first type any introductory text, such as "As we saw in Equation" and then issue the command Insert, Reference, Cross Reference.

cross reference options box

  1. Under Reference Type select Bookmark, and from the presented list of bookmarks, choose the appropriate one. Under Insert reference to select Paragraph number (full context) and click Insert.

Updating field numbering

If you add or delete equations in the middle of the document, the numbers may not be automatically updated. To update, press Ctrl+A for Select All, then press F9.

Creating equations in PowerPoint

You can copy and paste an equation from a Word 2007 document into PowerPoint, however the equation will appear as a bitmap graphic and will not resize gracefully. To get around this, increase the font size of the equation in Word before copying it.

See the notes for Microsoft Equation Editor 3.0 for instructions on how to use the previous version of the equation editor in PowerPoint.











本文转自 h2appy  51CTO博客,原文链接:http://blog.51cto.com/h2appy/1598278,如需转载请自行联系原作者
目录
相关文章
|
9天前
|
BI 开发者 数据格式
Python代码填充数据到word模板中
【4月更文挑战第16天】
|
3月前
typora中的公式怎么在word里面正常显示,怎么问可以让chatgpt的公式在word里面正常显示
typora中的公式怎么在word里面正常显示,怎么问可以让chatgpt的公式在word里面正常显示
130 0
|
3月前
|
Python
python处理word文档,如何提取文档中的题目与答案
python处理word文档,如何提取文档中的题目与答案
33 0
|
10月前
【Word】Word公式导出PDF后出现井号括号#()错误
【Word】Word公式导出PDF后出现井号括号#()错误
124 0
word添加参考文献和标注的详细简单方法
word添加参考文献和标注的详细简单方法
833 0
word添加参考文献和标注的详细简单方法
|
10月前
【Word】docx转doc后公式转换为图片不清晰/模糊
【Word】docx转doc后公式转换为图片不清晰/模糊
267 0
|
10月前
|
自然语言处理 Python
【Python办公自动化】python实现将图片插入到word中指定位置并将word转换为图片
【Python办公自动化】python实现将图片插入到word中指定位置并将word转换为图片
196 0
|
10月前
Word论文公式的两个格式问题
Word论文公式的两个格式问题
word长公式不换行显示的方法
word长公式不换行显示的方法
Word中使用MathType批量调整文档公式的大小
Word中使用MathType批量调整文档公式的大小
348 0
Word中使用MathType批量调整文档公式的大小