equal column width matrix?

  • Permalink
  • submit to reddit
  • Email
  • Follow


My supervisor would like his matrices to have equal column
width.   That means that a 0 entry would be centred in 
enough blank space to make the column width as wide as
the widest entry in the matrix.   This can probably be
hacked by measuring the widest entry and having the
other entries centred in a hbox that wide.  But is there
a more elegant and automatic way to do this?

David
0
Reply David 2/3/2011 8:29:35 PM

See related articles to this posting


In article <dalton-B09DCC.16593403022011@news.eternal-september.org>,
 David Dalton <dalton@nfld.com> wrote:

> My supervisor would like his matrices to have equal column
> width.   That means that a 0 entry would be centred in 
> enough blank space to make the column width as wide as
> the widest entry in the matrix.   This can probably be
> hacked by measuring the widest entry and having the
> other entries centred in a hbox that wide.  But is there
> a more elegant and automatic way to do this?

I forgot to mention that we are using the array
environment in LaTeX.

David
0
Reply David 2/3/2011 11:05:56 PM

Le 04/02/2011 00:05, David Dalton a �crit :
> In article<dalton-B09DCC.16593403022011@news.eternal-september.org>,
>   David Dalton<dalton@nfld.com>  wrote:
>
>> My supervisor would like his matrices to have equal column
>> width.   That means that a 0 entry would be centred in
>> enough blank space to make the column width as wide as
>> the widest entry in the matrix.   This can probably be
>> hacked by measuring the widest entry and having the
>> other entries centred in a hbox that wide.  But is there
>> a more elegant and automatic way to do this?
>
> I forgot to mention that we are using the array
> environment in LaTeX.
>
> David

You can try the tabu package as in:

\documentclass{article}
\usepackage[delarray]{tabu}

\begin{document}\makeatletter
{

$\begin{tabu}spread 1in|{*4{X[$c]}}|
     \alpha & \beta & \gamma & \delta \\
     \sum_i \frac{a_i}{x_i} & 0 & \cdot & \cdot \\
\end{tabu}$
}

\end{document}\endinput


But it still under development...

It's not possible to give standard l, c, r columns a specific width,
instead, embed your math content into a paragraph column

	>{$}m{width}<{$}

This is what tabu does, measuring the widths to make them
equal: "X[$c]" replaces
	">{\centering\arraybackslash}}>{$}p{some dimen}<{$}"

....
0
Reply GL 2/3/2011 11:33:37 PM
comp.text.tex 36555 articles. 70 followers. Post

2 Replies
343 Views

Similar Articles

[PageSpeed] 59


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Equal column widths in array environment
Hi all, Is there an *easy* (logical?) way of obtaining equal column widths in an array environment? This problem has been solved in a tabular environment, and there are numerous solutions. I'm looking for a solution in the following by any way of the following, if possible: [1] defining a new column type (that works in math mode) for columns that should be the same width (like p{..} for tabular); or [2] defining a new environment altogether, similar to array that works in math mode The above may be achieved either if the largest column width is known, or better, if it is not. One sol...

Treectrl
Hi all, I am using treectrl v2.1 to display a table of data. Is it possible to configure the table so that the columns all end up the same width? If I resize the window, I would like the extra space to be assigned equally amongst the columns so that they still remain of equal width. Is this possible? thanks, dan. > I am using treectrl v2.1 to display a table of data. Is it possible to > configure the table so that the columns all end up the same width? If I > resize the window, I would like the extra space to be assigned equally > amongst the columns so that they still remain ...

Making a matrix with equal rows and columns
I have a matrix value of 64 x 1 now I need to make this matrix as 8 x 8. How do I do that, if my matrix is 200 x 1 then How do i take a matrix of equal rows and columns. Please help me out . "vineet" <prasath_79@yahoo.com> wrote in message news:eeea9f2.-1@webx.raydaftYaTP... > I have a matrix value of 64 x 1 now I need to make this matrix as 8 x > 8. How do I do that, if my matrix is 200 x 1 then How do i take a > matrix of equal rows and columns. Please help me out . That's easy... make it 14.142135623731 by 14.142135623731. If that's not the answer, perhap...

tabular, columns centered with equal width
Hi there, I've got a little problem formatting tabulars. I want to use a tabular, say: \begin {tabular} {|c|c|c|} \hline 1& 2& 345 \\ \hline \end {tabular} The Problem occuring at this point is, that the last column is far wider than the other two. I want all columns to have the equal width, but be centered at the same time as well. The problem, in short, is that the options c and p{...} cannot e used all together. -- Johannes Reinhard Before God we are all equally wise - and equally foolish. Albert Einstein Got a solution using arry.sty and tabularx.sty \usepackage {a...

Normalizing matrix (rows AND columns equal to 1)
I'm working on a specific matrix and I need to normalize the sum of the elements in all the rows and all the columns to be equal to 1. I have managed to create the codes to do both separately but does anyone know how to obtain both simultaneously? thank you!!! On 11/21/2012 4:55 PM, zuzia wrote: > I'm working on a specific matrix and I need to normalize the sum of the > elements in all the rows and all the columns to be equal to 1. I have > managed to create the codes to do both separately but does anyone know > how to obtain both simultaneously? > thank you!!! ...

HP 48/49: Matrix editior, where is the column width stored?
Hello together, I wondering, where I can find/read the width of columns, used within the matrix editor? Within the matrix editor it is possible to change the width of the columns with <-WID and WID->, but where is this info stored? How can I store or reset the width of columns? Best regards Heiko Hi Heiko, just take a look into the code behind the related menu keys;-) There are LAMs inside the matrix application to recall and store the width, and a display metrics update function. Let's call it 'ChangeWidth' :-) For more details just drop me a mail. Hmm, reminds m...

Modify last column in a matrix, replacing with an equally spaced range of values?
I'm generating a 42*42 matrix, T, of temperature values. Most interior values are 10 (initial guess for iteration purposes). Row 1 is all 4's, row 42 all -17. I need to make the final column (42) a range of equally spaced values from 4 to -17. What's the best way to do this? Below is how I'm doing this so far (forgive me, I'm VERY new at this): T=10*ones(42,42); T(1,1:end)=4; T(42,1:end)=-17; I don't know how to handle the final column simply? I can change the full column with T(:,end)=new_value So I've been trying variations on that, say with a range on the ...

Is there a way to make row height equal to column width when you don't know value in advance?
Hi again, I appreciate all the advice I've gotten so far. My question this time is whether there's a way to make the row height equal to the column width when you don't know in advance what you'll be using. The content of each cell is text. Thanks if anyone has any ideas for me. I'm starting to think the answer is no. I've experimented with cellpadding, but that adds space in all four directions. John John wrote: > Hi again, > > I appreciate all the advice I've gotten so far. > > My question this time is whether there'...

A matrix that selects some predetermined columns from another matrix to produce a matrix that cosists of those columns
Hi, I would like to come up with a matrix to takes some columns of another matrix and puts them into the other matrix. For example, for X = [x1 x2 x3 x4] where xi is n x 1 vector, XJ = [x2 x3]. So, J has to be n x 2. Thanks in advance! usuiisu usuiisu <ikuyasu@gmail.com> wrote in message <526a92f2-79e0-450e-bceb-7bd8a838a661@30g2000yql.googlegroups.com>... > Hi, > > I would like to come up with a matrix to takes some columns of another > matrix > and puts them into the other matrix. For example, > for X = [x1 x2 x3 x4] where xi is n x 1 vecto...

Convert two matrixes ca and y with 2 columns in a matrix w with on column ca and one column y
Dear Matlab User, I have following problem. I use a programm called dynare it is written to make the use of Matlab easy. By this programm I get in Matlab two matrizes one is called ca and one is called y. Each of these matrizes consist of n artifical time series produced by matlab written in the colums of the matrix. for example: ca=[5 8 and y = [4 3 1 2] 3 1] and now I want to convert them in w =[ca y]=[5 4 1 3] and another w=[ca]=[8 3 2 1] Is their an easy matlab code to do that? I have Matrizes with 5000 columns. Thanks in advance Julia Julia Hof...

Moving columns below other columns, in a matrix
Hi everyone! Say I have a 6x6 matrix - what is the easiest way of moving the rightmost 3 columns below the leftmost 3 columns, such that the matrix becomes 12x3? Thanks for any help! On May 5, 3:51=A0pm, "Catalin Eberhardt" <longtal...@gmail.com> wrote: > Hi everyone! > > Say I have a 6x6 matrix - what is the easiest way of moving the rightmost= 3 columns below the leftmost 3 columns, such that the matrix becomes 12x3? > > Thanks for any help! A =3D magic(6); B =3D [A(:,1:3);A(:,4:6)] or: B =3D [reshape(A(:,1:3:end),[],1) reshape(A(:,2:3:...

Comparing the columns of a matrix to a column
Hi, Suppose I have a matrix M that looks like this: M=[1 2 3 4; 5 6 7 8] and I would like to see which columns of M = [1;2]. Is there any easy way to do this, without using a for loop? I thought maybe I would have some luck using find, but have had none thus far. Any help would be appreciated. Thank you, Kim Try that incredibly useful but somewhat non-intuitive "strmatch" trick that I learned from <us> on this NG: >> M=[1 2 3 4; 5 6 7 8] M = 1 2 3 4 5 6 7 8 >> test = [2;6] test = 2 6 >> strmatch(test.',M.') ans = ...

substruction of of one column from other column of matrix
Hi, I have to do substruction of of one column from other columns of a big matrix. For example I have 3 column c1,c2 and c3. I have to substract c2 and c3 from c1 and c3 from c2. I can substract one vector from a matrix. But how can I do it for a big matrix? Thank you. Sunipa Som ...

Multiplying each matrix column by a column vector
I remember using a function that multiplied each column (or optionally row) of a matrix by a specific column (or optionally row) vector. It seems impossible to find the function in the MATLAB help since I don't remember the name. Anyone know which one I'm talking about? Thanks, Bryan I don't know of such a particular function; however, for any matrix A and column vector v, it would seem straightforward to accomplish your task with: A.*repmat(v, 1, size(A,2)) There's probably a more elegant/faster way that avoids using repmat, but I forget at the moment how to index matrices...

converting a column matrix to a NxM matrix
Dear all, I have a 800x1 matrix that has 11 different numerical values in it. I need to create a 11x800 matrix from this one that is set to 1 to related value in its column and all other values set to 0. To be more clear, let me give an example with lower values. Lets assume a 10x1 matrix that includes 3 different values in it, 4,6,9 matrix= 4 4 6 9 4 6 6 9 4 6 I want to obtain a 3x10 binary matrix from this one which will seem like: 1 1 0 0 1 0 0 0...

Multiply columns in a matrix by a column array
I have the following scenario: x1 = [1; 2; 3; 4; 5]; x2 = [2 7; 3 8; 4 9; 5 10; 6 11]; x2 may vary in the number of columns, and the number of rows will be large, but equal. I would like to multiply the values in each row of x2 by the value in the corresponding row of x1. The desired result from the example would be: 2 7 6 16 12 27 20 40 50 55 What's the best way? Typo: The last line of the result should be '30 55' not '50 55' Christopher Brown wrote: <Summary: He want to multiply each columin in a (for example) 5x2...

Replacing a column in a matrix with another column
I'm fairly new to MATLAB and im wondering if there is a way to replace all the data in one column with all the data from another column in a different matrix. I guess a for loop would work but i'm wondering if there's a nifty command to do this? Thanks, Dave. David Kunik wrote: > I'm fairly new to MATLAB and im wondering if there is a way to > replace all the data in one column with all the data from another > column in a different matrix. I guess a for loop would work but i'm > wondering if there's a nifty command to do this? Of course, there is... :) ...

How to Change Matrix in to single column matrix
hello friends... I have a matrix A = [ 1 2 3 4 5 6 7 8 9 ]; I want to change this matrix into single coloumn format, such as A = [ 1 2 3 4 5 6 7 8 9 ]; Please provide me the proper MATLAB command to do above operation. Mahesh Mahesh Neupane: <SNIP wants to reshape his/her mat... some of the solutions b=reshape(permute(A,[2 1]),[],1) % -or- b=A.'; b=b(:) others will have better ones us Sorry, i can't help you, but i have a question that looks like yours. How can i take one column out of a mat...

adding column vector of a matrix to another matrix
Hi, I have two matrices (3x4) A= B= 1 5 6 6 5 4 4 7 9 1 2 1 2 3 0 3 2 7 1 2 1 0 1 1 I would like to add the last column vector of B to the matrix A, so as to obtain a 4x4 matrix. How can I do that? Thanks ALL in advance On 7/6/2013 6:05 AM, m wrote: > Hi, > > I have two matrices (3x4) > A= B= > 1 5 6 6 5 4 > 4 7 9 1 2 1 > 2 3 0 3 2 7 > 1 2 1 0 1 1 Those are 3x4, no...

how to break a big column matrix into 2d matrix?
Hi friends, I have a matrix of dimension (2541 x 1). I need to rewrite this matrix into (121 x 21) The first 121 elements in matrix one will be the first row in second matrix and so on.... remember 121 x 21 =2541 please can someone help me... thanks in advance... cheers On Wed, 12 May 2010 15:02:21 -0400, subbu <ysrhcu@yahoo.com> wrote: > Hi friends, > > I have a matrix of dimension (2541 x 1). I need to rewrite this matrix > into (121 x 21) > The first 121 elements in matrix one will be the first row in second > matrix and so on.... >...

how to find the closest columns of each columns in the matrix fast
hi, i have a 16x20000 matrix and i want to find the closest vector for each column in the matrix based on the euclidean metric. The brute-force approach is to compute euclidean metric sequantially for each column and this requires a 20000x20000 computation and takes a very long time. So anybody can suggest a faster implementation ? finally i ll fill a vector containing the each closest vector's index in the matrix like : closest(1,i) = j ; j is the closest column to i in the matrix.. thanks in advance. kadir wrote: > > > hi, i have a 16x20000 matrix and i want to find the closest...

subtracting column vector from every column in matrix ...
how do i go about doing this? do i need to replicate the column vector into a matrix with duplicate column entries, and subtract from the original matrix? any help appreciated. thanks, old student wrote: > > > how do i go about doing this? > do i need to replicate the column vector into > a matrix with duplicate column entries, and subtract > from the original matrix? > any help appreciated. > thanks, There's a function called repmat() that people often use. However, all it's doing is this: a=magic(5); % example matrix b=(1:5)'; % example column c=a-b(:,...

matrix column deletion with know column indices
Hi I want to delete several columns in a matrix and get the resulting matrix, what is the fastest way to do this. I saw some posts but didn't understand them. For example 1 2 3 4 5 6 7 8 9 10 I want to delete columns [1 3] and get 2 4 5 7 9 10 what is the fastest way to do this. Thanks Diego "Diego Lass" <dlISCool@gmail.com> wrote in message <h0veo5$rpk$1@fred.mathworks.com>... > Hi > I want to delete several columns in a matrix and get the resulting matrix, what is the fastest way to do this. I saw some posts but didn't understand them. > >...

How to set table column width except the last column?
My table has 5 columns. I want to set column width for the first 4 columns. But for the last column, I prefer to have it auto sized width, therefore the table total width is maximized and does't not appear horizontal scroll bar. "Cal" <Allen.Chenal@gmail.com> wrote in message news:1168235426.669765.15370@s34g2000cwa.googlegroups.com... > My table has 5 columns. > I want to set column width for the first 4 columns. But for the last > column, I prefer to have it auto sized width, therefore the table total > width is maximized and does't not appear horizonta...