# Tag Info

32

This answer has four five six four routines: the last update: leaner code 6, as I understand better my hacky use of \pdfescapestring and could remove some superfluous extras (if they had been really needed, these extras would not have been enough anyhow). the very last update: improved sub-routine for merging in code 6 bringing at least a 2x speed ...

31

This answer consists of three parts: a solution with manual adjustment of the vertical spacing, a solution with a modified \arraystretch that automatically centers the brackets around the matrix properly (unlike the original \arraystretch!), an explanation of the ugly default spacing. The easy answer You have two issues here: The spacing is ugly &...

29

It's been a while since I played with NumPy, but I used to call the numpy.savetxt function to export my data as a .csv format: import numpy A = numpy.random.randn(4,4) numpy.savetxt("mydata.csv", A) The sample file mydata.csv was generated accordingly: 1.058690791897618361e-01 4.236767150069661314e-01 -9.871862191240249329e-02 1.896410657805123634e+00 -3....

29

I ran your code but it appeared to be very slow, I suspect from all the \pgfmathtruncatemacro. But here we can do all calculations with \numexpr easily. This code is based on the TeX primitives \ifnum, \ifcase and \csname..\endcsname. I have used \foreach loops in the first two code samples as I wanted to stay close to your original framework. In the third ...

27

As @whlt3 said it is required if you intend to have a final horizontal line \hline or a partical line via \cline{...} or if you want to have some extra space blow that line produced via the optional argument of \\. If not then it is completely optional. I would however suggest to use \\ on all lines as that allows you to easily add or reorder rows in your ...

27

To answer the specific question you are asking, here is a complete minimal example. \documentclass{standalone} \usepackage{pgfmath} \begin{document} \def\names{{"Katie","Frank","Laura","Joe"}}% \pgfmathparse{\names[2]}\pgfmathresult \end{document} So, you need to use the pgfmath parser to do the job through \pgfmathparse and then use the result of the ...

24

You can stick some \struts in there (the height+depth of a paren): \documentclass{article} \usepackage{mathtools} \begin{document} $\begin{bmatrix} \dfrac{\strut\partial f}{\strut\partial x} \\ \dfrac{\strut\partial f}{\strut\partial y} \end{bmatrix}$ \end{document}

24


15

Rather than fiddling with \hline, it's better in your case to provide "struts": either a "top strut," which provides vertical spacing above the line where it's placed, or a "bottom strut," which provides vertical spacing below the line where it's placed. This idea is not original to me -- it goes back (at least) to an article published by Claudio Beccari in ...

14

Here's a possible solution using a tabular: \documentclass{article} \usepackage{array} \newcolumntype{P}{% >{\rule[-0.6cm]{0pt}{1.5cm}\centering$}p{1cm}<{$}} \begin{document} \noindent\begin{tabular}{!{\vrule width 2pt}P|P!{\vrule width 2pt}P|P!{\vrule width 2pt}} \noalign{\hrule height 2pt} a & b & c & d \tabularnewline \hline a & ...

14

Basic Example: Here is an example of one way to reproduce the Division Algorithm from Page 4 of Grobner Bases and their Applications by Kaitlyn Moran using an array. Notes: multirow was used to center the \sqrt{xy^2 + 1} term in between the two rows. \multicolumn{1}{c}{<text>} was used to center content within a cell Extended Example For the ...

14

The spacing is all wrong if you use an array, the AMS alignments provide alignment whilst preserving operator spacing: \documentclass{article} \usepackage{amsmath} \begin{document} $$\begin{array}{ccl} a + b + c & = & d \\ e + f & = & g \\ h & = & i \end{array}$$ \begin{...

14

A possibility using TikZ and matrix of math nodes (from the matrix library) to build the natrices; the braces for the dimensions were built using a brace decoration from the decorations.pathreplacing library: \documentclass{article} \usepackage{tikz} \usepackage{geometry} \usetikzlibrary{matrix,positioning,decorations.pathreplacing} \begin{document} \...

13


13

add something like \setlength\arraycolsep{20pt} before the array.

Only top voted, non community-wiki answers of a minimum length are eligible