8

Here, I use \stretchleftright{|}{...}{|} to achieve it. \documentclass{article} \usepackage{scalerel,amsmath} \begin{document} \[ \cos\phi=\stretchleftright{|}{\frac{ \begin{pmatrix}1\\1\\1\end{pmatrix} \circ \begin{pmatrix}1\\2\\3\end{pmatrix} }{ \sqrt3\cdot\sqrt{1^2+2^2+3^2} }}{|} \] \end{document}


7

I'd like to suggest a solution that's different from either of your preferred choices. \documentclass{article} \usepackage{mathtools} % for '\DeclarePairedDelimiter' macro \DeclarePairedDelimiter{\abs}{\lvert}{\rvert} \begin{document} \[ \cos\phi= \frac{1}{\sqrt3 \cdot\sqrt{1^2+2^2+3^2}} \abs*{\begin{pmatrix}1\\1\\1\end{pmatrix}\circ ...


6

The braces work in math mode, generally conforming to the size of the content by way of \left\{<content>\right. for only an opening brace (or \left.<content>\right\} for only a closing brace). The slight "break" in the brace of the OP's image is an on-screen artifact associated with the magnification level (it's not really there). With ...


5

All you have to do is set the interior structure using a tabular; this will set the contents in text mode rather than math mode (as it would with an array or similar environment): \documentclass{article} \begin{document} $\left\{\begin{tabular}{@{} c @{}} the first sentence \\ the second sentence \\ the third sentence \\ the fourth sentence \end{...


4

Let me present a different solution using semantex (disclaimer: I am the author). It works as expected except in the case of auto-scaled parentheses (if you want to make this work, you can write \Prob[par=auto,break]{ X \vphantom{\sum} } instead): \documentclass{article} \usepackage{semantex,amsfonts} \NewVariableClass\MyVar[ definekeys={ {...


4

A couple of hand corrections in the middle column but... \documentclass{article} \usepackage{mathtools,amsfonts} \DeclareMathDelimiter{\given} {\mathbin}{symbols}{"6A}{largesymbols}{"0C} \newcommand{\prob}{\mathbb{P}} \DeclarePairedDelimiterXPP{\Prob}[1] {\prob}{\lparen}{\rparen}{} {\renewcommand{\given}{\;\delimsize\vert\nonscript\;\...


2

Here are some solutions: \documentclass{article} \usepackage{mathtools} \DeclarePairedDelimiter{\parens}{(}{)} \begin{document} \begin{align} &\cos \left( \frac{t}{2} \right) \\ &\cos \mathopen{}\left( \frac{t}{2} \right) \\ &\cos\! \left( \frac{t}{2} \right) \\ &{\cos} \left( \frac{t}{2} \right) \\ &\cos \parens*{\frac{t}{2}} \end{...


2

You can use \cos^{n} \mathopen{}{\left( argument\right)} but auto-generated output has one problem: it is unable to generate human friendly text. Human can write \cos^2 x or \cos^2 (x+y) but machine must geneate \cos^{2} \mathopen{}{\left(x+y\right)}. Unfortunately. TeX language for math formula was intended for humans, not for machines.


1

I don't see an user interface, but this here could work: \documentclass{article} \begin{filecontents}[overwrite]{\jobname.mst} delim_n "; " \end{filecontents} \usepackage{imakeidx} \usepackage{hyperref} \makeatletter \def\@commahyperpage#1{\@@commahyperpage#1; ;\\} \def\@@commahyperpage#1; #2;#3\\{% \ifx\\#2\\% \HyInd@pagelink{#1}% ...


1

Finally, I chose \DeclarePairedDelimiter\myParentheses{\lparen}{\rparen} \newcommand{\pth}[1]{\myParentheses*{#1}} from the package math tools.


1

You can use the features of xparse that is good in these cases and doesn't require further tricks. \documentclass{article} \usepackage{amssymb} \NewDocumentCommand{\expec}{O{X}}{\mathbb{E}[#1]} %\newcommand{\bbE}[1][X]{\mathbb{E}\left[#1\right]} \begin{document} Working: $\expec[XY]$ Working: $\expec[\expec[X]]$ and $\expec[\expec[Y]]$ \end{document} ...


1

Another fix: While latex is looking for the optional argument of the outer command stop (]) it finds the square bracket of the second (inner) command and stops there... This is happening because it works with similar way of my first definitions (see \def commands) that contains something like \@ifnextchar[ and ends at the first ] ... By defining the \@lp (...


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