English 中文(简体)
How to put line break in a math
原标题:
  • 时间:2009-11-09 21:16:13
  •  标签:
  • latex

I d like to express the following sentence (source_location is also italic, it s not correctly rendered):

Each entry has a list of tuple: < source_location, R/W, trip_counter, occurrence, killed (explained in the later) >

My current workaround for this is:

$ leftlangle
	extit{source\_location}, 	extit{R/W}, 	extit{trip\_counter},
	extit{occurrence}, 	extit{killed} 	ext{(explained in the later)}

ight
angle $

I m using 2-column paper. This < .. > is too long, but no line break because it is a math. How do I automatically (or manually) put line break in such case? It seems that leftlangle and ight angle should be in a single math. So, hard to break into multiple maths.

$<$ and $>$ would be an alternative, but I don t like it.

最佳回答

Why not define a new command:


ewcommand{	uple}[5]{$langle$	extit{#1}, 	extit{#2}, 	extit{#3}, 	extit{#4},
   	extit{#5} (explained in the latter)$
angle$}

Then use uple{sourcelocation}{R/W}{tripcounter}{occurrence}{killed}

问题回答

LaTeX does allow inline maths to break over lines by default, but there are a number of restrictions. Specifically, in your case, using left... ight puts everything inside a non-breakable math group, so the first step is to replace them with either just plain langle... angle or perhaps igllangle...igr angle.

However, this still isn t enough to permit linebreaking; usually that s still only allowed after relations or operators, not punctuation such as the comma. (I think this is what s going on anyway; I haven t stopped to look this up.) So you want indicate where allowable line breaks may occur by writing linebreak[1] after each comma.

Depending how often you have to do this, it may be preferable to write a command to wrap your "tuples" into a nice command. In order to write this in your source:

$ mytuple{ source\_location, R/W, trip\_counter, occurrence,
    killedupshape (explained in the later) } $

here s a definition of mytuple that takes all of the above into account:

makeatletter

ewcommandmytuple[1]{%
  @tempcnta=0
  igllangle
  @for@ii:=#1do{%
    @insertbreakingcomma
    	extit{@ii}
  }%
  igr
angle
}
def@insertbreakingcomma{%
  ifnum @tempcnta = 0 else,, linebreak[1] fi
  advance@tempcnta@ne
}
makeatother

There seems to be a package that addresses that problem, called breqn. You can try this and let us know (I haven t used that).

I d use the align* environment from AMSmath. Furthermore you could just add "" to break the lines? Should work in math environments, too. Alternatively you could separate the equations.





相关问题
Effective Version Control for Slides

I have to maintain a huge set of training material in forms of slides. At a first glance, I ve noticed there s no support for version control in OpenOffice OOImpress (but I might be wrong on this). ...

Maths in LaTex table of contents

I am trying to add a table of contents for my LaTex document. The issue I am having is that this line: subsubsection{The expectation of (X^2)} Causes an error in the file that contains the ...

Using vim s `gqap sometimes indents unusually

For the life of me, I cannot figure out the cause of this: when writing in LaTeX documents, I like to keep my line width to maximum of 80 characters. As such, I will execute the vim command gqap and ...

aligning math equations in Latex

I am trying to align the following equations around the equal sign. What can I do? Thanks! I am using the AMSMath package $$mddot{x}_{1}-K(x_{2}+x_{12})+C(dot{x}_{12}+dot{x}_{2})+2Cdot{x}_{1} ...

LaTeX output does not update

I have just begun using LaTeX. I am working in Windows and am using TeXnicCenter as my editor. When I build and output, having the following code: documentclass{article} egin{document} This is a ...

How to put line break in a math

I d like to express the following sentence (source_location is also italic, it s not correctly rendered): Each entry has a list of tuple: < source_location, R/W, trip_counter, occurrence, killed ...

热门标签