3

I was trying to write an optimization problem in which "subject to" part is a vector statement. however it doesn't look good. enter image description here

     \[ \begin{array}{clcll}
     \textrm{min} & \|k_i\|^2 &\equiv &\textrm{min} & \|k_i\|^2\\
     \text{s.t. } & \begin{array}{c}
     k_i'w_1=0 \\
     \vdots\\
     k_i'w_i=1\\
     \vdots\\
     k_i'w_n=0
     \end{array}
     & &\text{s.t. } &\left[\begin{array}{c}\textendash w_1\textendash \\
     \vdots\\
     \textendash w_i\textendash \\
     \vdots\\
     \textendash w_n\textendash \end{array}\right]
     \left[\begin{array}{c}| \\
     k_i\\
     |\end{array}\right]=
     \left[\begin{array}{c} 0 \\
     \vdots\\
     1\\
     \vdots\\
     0 \end{array}\right]=e_i
     \end{array}\] 

Is there any way to force the vectors to be more compacted? (to occupy less space)

2
  • Welcome to TeX SX! What do the k_i' s have to do with the k_is?
    – Bernard
    Jan 8, 2016 at 20:39
  • @Bernard k_i is one column of a matrix and k-i' is its transpose
    – SMA.D
    Jan 8, 2016 at 21:20

3 Answers 3

6

try this. i've suppressed some of the vertical space around the \vdots and used the matrix environments from amsmath to close those up a bit.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\xvdots}{\vphantom{{\sum^0}^0}\smash{\vdots}}

\begin{document}
\begin{alignat*}{2}
&\textrm{min} \quad \|k_i\|^2 &\ &\equiv \textrm{min} \quad \|k_i\|^2\\[2pt]
&\text{s.t.}\quad \ \,
 \begin{matrix}
   k_i'w_1=0 \\
   \xvdots\\
   k_i'w_i=1\\
   \xvdots\\
   k_i'w_n=0
 \end{matrix}
 &\ & \phantom{{}\equiv{}} \text{s.t.} \quad
  \begin{bmatrix}
   \text{--} w_1\text{--} \\
   \xvdots\\
   \text{--} w_i\text{--} \\
   \xvdots\\
   \text{--} w_n\text{--}
  \end{bmatrix}
  \begin{bmatrix}
   | \\
   k_i \\
   |
  \end{bmatrix}
  =
  \begin{bmatrix}
   0 \\
   \xvdots\\
   1 \\
   \xvdots\\
   0
  \end{bmatrix}
  = e_i
\end{alignat*}
\end{document}

output of example code

4
  • Thank you, that's pretty nice. Is it possible to reduce the horizontal space between two matrices that are being multiplied. i.e. \text{--} w_1\text{--} \\ \xvdots\\ \text{--} w_i\text{--} \\ \xvdots\\ \text{--} w_n\text{--} and | \\ k_i \\ |?
    – SMA.D
    Jan 8, 2016 at 21:35
  • sure it's possible. there's a line between the first two bmatrix components. just remove that. (i'll edit in a modified version, with this change.) Jan 8, 2016 at 21:39
  • if they're still not close enough, inserting a small backspace -- \! -- between them should fix that. Jan 8, 2016 at 21:44
  • I looked below, but you were above, +1 anyway:-) Jan 8, 2016 at 21:51
1

Here is another option showing how you can manipulate the row spacing using portions of \normalbaselineskip:

enter image description here

\documentclass{article}
\usepackage{mathtools,array}
\begin{document}
\[
  \setlength{\arraycolsep}{0pt}
  \begin{array}[t]{l}
    \min \|k_i\|^2 \\[.5\normalbaselineskip]
    \text{s.t. }
    \begin{array}{r>{{}}l}
      k_i'w_1 &= 0 \\[-.4\normalbaselineskip]
      & \vdotswithin{=} \\[-.1\normalbaselineskip]
      k_i'w_i &= 1 \\[-.4\normalbaselineskip]
      & \vdotswithin{=} \\[-.1\normalbaselineskip]
      k_i'w_n &= 0
    \end{array}
  \end{array}
  \quad \equiv \quad
  \begin{array}[t]{l}
    \min \|k_i\|^2 \\[.5\normalbaselineskip]
    \text{s.t. }
    \left[\begin{array}{c}
      \text{-- } w_1 \text{ --} \\[-.4\normalbaselineskip]
      \vdots \\[-.1\normalbaselineskip]
      \text{-- } w_i \text{ --} \\[-.4\normalbaselineskip]
      \vdots \\[-.1\normalbaselineskip]
      \text{-- } w_n \text{ --}
    \end{array}\right]
    \left[\begin{array}{c}
      | \\ k_i \\ |
    \end{array}\right]
    =
    \left[\begin{array}{c}
      0 \\[-.4\normalbaselineskip]
      \vdots \\[-.1\normalbaselineskip]
      1 \\[-.4\normalbaselineskip]
      \vdots \\[-.1\normalbaselineskip]
      0
    \end{array}\right]
    = e_i
  \end{array}
\] 

\end{document}
0
0

Not totally happy with it but you could start tinkering from here:

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}
 \[   
\min
_{\mathrlap{\substack{ 
     \text{s.t.}\\
     k_i'w_1=0 \\
     \vdots\\
     k_i'w_i=1\\
     \vdots\\
     k_i'w_n=0}}}
  \|k_i\|^2
\quad\equiv\quad
\min 
_{\mkern-18mu\mathrlap{\substack{
     \text{s.t.}\\
   \left[\begin{smallmatrix}\text{--} w_1\text{--} \\
     \vdots\\
     \text{--} w_i\text{--} \\
     \vdots\\
     \text{--} w_n\text{--} \end{smallmatrix}\right]
     \left[\begin{smallmatrix}| \\
     k_i\\
     |\end{smallmatrix}\right]=
     \left[\begin{smallmatrix} 0 \\
     \vdots\\
     1\\
     \vdots\\
     0 \end{smallmatrix}\right]=e_i}}}
\|k_i\|^2
\] 

\end{document}
5
  • ...hmmm... this doesn't look good.
    – Werner
    Jan 8, 2016 at 21:00
  • @Werner it looks pretty horrible actually but the components are probably there, mathtools, \min , \substack are more likely to make something usable than just using array. Probably needs a different layout altogether though really. Jan 8, 2016 at 21:06
  • hmmmph. surely you could have done better without much effort. the only really badly designed "original" component is the \vdots, which have always had too much space at the top. Jan 8, 2016 at 21:24
  • @barbarabeeton I'd be happy to vote for your answer if you made one:-) Jan 8, 2016 at 21:40
  • see below. (appreciate the appreciation.) Jan 8, 2016 at 21:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .