New answers tagged

2

You can't have all the rest of the stuff to the \\ before the \else when the antecedent of the conditional is false because TeX assumes that the end of the conditional will never terminate. You can work around this by doing something like the following \documentclass{article} \usepackage{amsmath} \newcounter{opc} \newcommand{\optimizationproblem}[3] {% \...


3

It's the usual problem of a conditional straddling two columns. There's a simpler solution: print “subject to” only if not already printed. \documentclass{article} \usepackage{amsmath} \newif\ifsubjectto \newcommand{\optimizationproblem}[3]{% \global\subjecttotrue \begin{array}{ll} \text{#1} & #2 #3 \end{array}% } \newcommand{\constraint}[1]{% ...


2

You can make a longtable environment look very much like an array environment. The longtable environment provides for automatic page breaking, and you can give it a \caption, if need be. If it's not possible to tell which of the following two arrays was created with longtable and which was created with array, that's by design. :-) \documentclass{article} ...


2

If you want different columns to be the same width you need to know what that width is ahead of time. \documentclass{article} \usepackage{blkarray} \newcommand{\tensorblock}[1] { \begin{blockarray}{c@{~}c@{~~}cc} && \BAmulticolumn{2}{c}{T_{4}} \\ && \makebox[\widest]{1} & \makebox[\widest]{2} \...


0

In LyX, I added \usepackage{amsmath} to Document -> Settings -> LaTeX Preamble. Then instead of using array environment, which generates I change to aligned environment, which generates a much better looking equation array and spacing There are other discussions on the left alignments that seem very complicated. But what I found in my case is that, if ...


4

While there probably is a pure LaTeX solution, one can try with tikz : \documentclass{standalone} \usepackage{tikz} \begin{document} $\left(\tikz[scale=.9, baseline={(0,-.1)}]{\draw(-1,0)--(1,0) (0,-1)--(0,1) (-.4,0) -- +(0,-1) (0,.4) -- +(1,0);\node at (-.5,.5) {T}; \node at (.5,-.5) {B}; \node at (-.2,-.5) {$a$}; \node at (.5,.2) {$a^t$};}\right)$ \end{...


4

You can put the column labels inside a right overlap, which effectively puts it inside a zero-width box that is left-aligned: $$ \begin{array}{r|lll} & \rlap{\text{number of foo}} \\ \text{number of bar} & 0 & 1 & 2 \\ \hline 0 & 0.125 & 0.250 & 0.168 \\ 1 & 0.125 & 0.250 & 0.168 \\ 2 & 0....


1

You can do it with blkarray: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fourier, erewhon} \usepackage{multirow,bigdelim} \usepackage{mathtools, blkarray} \begin{document} \[ \everymath{\displaystyle} A = \begin{blockarray}{cccccccc} & K & & L₁ & & L₂ \\[1ex] % \begin{block}{(c@{}ccccc@{\;}c)...


2

I am not sure i understood the question you want \documentclass{book} \usepackage{lipsum} \usepackage{amsmath} \usepackage[a4paper]{geometry} \makeatletter \@addtoreset{equation}{section} \renewcommand\theequation{\thesection.\@arabic\c@equation} \makeatother \begin{document} \chapter{Foo} \section{Foo bar} \begin{equation} \begin{array}{lll} \...



Top 50 recent answers are included