0

I want to know how to express this function in LaTeX. Can anyone help me?

enter image description here

Masroor
  • 17,842
  • 1
    \( \min\|w\|_1 \), s. t. \( Aw=y\). Since you are new you might pick up some practice :) Have a look at http://tex.stackexchange.com/questions/510/are-and-preferable-to-dollar-signs-for-math-mode – percusse May 16 '15 at 22:02
  • \( \min \Vert x \Vert_1, \text{s. t.} Aw=y \) -- two vertical bars, and needs text mode for the s.t. abbreviation if treated as a single equation. – Mike Renfro May 16 '15 at 22:03
  • some good advice here: Absolute Value Symbols. pay particular note to the answers that mention "norm". – barbara beeton May 16 '15 at 22:18
  • \( \min \Vert x \Vert_1\), s.t. \(Aw=y \) if on line, and \[\min\Vert x\Vert_1, \text{ s.t. } Aw=y\] if displayed – Guido May 16 '15 at 22:19
  • @Guido - the solution you've posted risks generating an extra bit of space after "s.t.". Better to write it as s.t.\, so that LaTeX and TeX won't think the second period terminates a sentence. – Mico May 17 '15 at 00:13

1 Answers1

3

The best, i.e., "most LaTeX-y" way to typeset this expression is to set up a macro named, say, \norm, that takes one argument -- the term(s) to be encased in double vertical bars. With the method shown in the example below, it's easy to change the size of the bars, if needed, by providing an optional argument to the \norm macro.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for "\DeclarePairedDelimiter" macro
\DeclarePairedDelimiter{\norm}\lVert\rVert % declare \norm macro
\usepackage{newtxtext,newtxmath} % optional, for Times Roman text and math fonts

\begin{document}
$\min\norm{w}_1, \text{ s.t.\ $Aw=y$}$
\end{document}
Mico
  • 506,678
  • Well, in that case, I would definitely exit math mode to typeset s.t., I mean $\min a \text{ s.t.\ $A$}$ looks harder than $\min a$, s.t. $A$. Any reason you chose that? – Manuel May 17 '15 at 01:22
  • 1
    @Manuel - Q: "Any reason you chose that?" A: Two reasons. First, if the full expression occurs in display-math rather than in inline-math mode, the expression itself needn't be changed. (All that would need to be changed is the outer $ pair.) Second, and equally importantly, the sub-expression s.t.\ $Aw=y$ forms one syntactical unit. Embedding it in a \text macro respects the sentence's syntax, whereas your proposed solution does not. – Mico May 17 '15 at 02:19
  • @Mico While I might agree on the first reason, I'm not sure about the second. Would you use the same if s.t. was fully spelled out (such that)? including in \text would prevent line break between "such" and "that". And what about longer expressions instead of s.t.? – Guido May 17 '15 at 09:46
  • @Guido - The main point of the second reason I gave is that it's a very good idea to pay attention to syntactical units when performing typesetting. For instance, inter-word spacing in a unit that is mostly text (even if some elements are math expressions) should obey the rules for text-mode material. Depending on the font family in use, one cannot and/or should not assume that the space induced by \ (the macro to introduce a "space" token) is the same in math mode and text mode. Hence my preference for having the argument of \text include the math elements of the syntactical unit. – Mico May 17 '15 at 10:43