1

I have two questions I'd like to ask and get feedback on.

enter image description here

First, I'm currently trying to write an equation into latex but for some reason, the formatting isn't spacing the way I want it to. I want the second vector in the subscript v2 to be outside of the subscript. And also, the numbering for the equation is right next to the equation for some reason. Does anyone have a suggestion on how to fix this?

enter image description here

Second, how do I go about wrapping matrices with parentheses?

\documentclass[14pt]{extarticle}
\usepackage{amsmath,amsthm,amsfonts,amssymb,amscd}
\usepackage{esvect}

\begin{document}

\begin{bmatrix}
    1 \\
    2 \\
    3 \\
    4 \\
\end{bmatrix}
\begin{bmatrix}
    5 \\
    6 \\
    7 \\
    8 \\
\end{bmatrix}


\begin{equation}
    \vv{y_2} = \vv{v_2} - proj_\vv{\mu_1} * \vv{v_2}
\end{equation}

\end{document}

Thanks!

  • Welcome to TEX.SE! Please provide a full minimal working example starting with \documentclass{...} and ending with \end{document} instead of code snippets. This makes our lives easier and increases the chance of people helping you – campa Oct 17 '19 at 7:36
  • Thanks, changes have been made. – sdfdsgfdoi123 Oct 17 '19 at 7:40
  • If you want to switch bracket matrices into parentheses matrices, you should switch \begin{bmatrix}...\end{bmatrix} into \begin{pmatrix}...\end{pmatrix}. As @Egreg mentioned it, you must use it in math mode so wrap the environment between \[...\]. – Piroooh Oct 17 '19 at 8:15
1

You get a few errors from that code.

Complex subscripts (more than a single letter or digit) should be braced:

\documentclass{article}
\usepackage{amsmath}
\usepackage{esvect}

\newcommand{\proj}{\mathrm{proj}}

\begin{document}

\begin{equation}
\vv{y_2} = \vv{v_2} - \proj_{\vv{\mu_1}} * \vv{v_2}
\end{equation}

\end{document}

enter image description here

I'm not sure about *, which is rarely, if at all, used in such contexts. I'd expect

\documentclass{article}
\usepackage{amsmath}
\usepackage{esvect}

\DeclareMathOperator{\proj}{proj}

\begin{document}

\begin{equation}
\vv{y_2} = \vv{v_2} - \proj_{\vv{\mu_1}}(\vv{v_2})
\end{equation}

\end{document}

enter image description here

|improve this answer|||||
  • Thank you! I'm still very new to latex as I am now taking my first class ever that requires homework to be written up in latex. – sdfdsgfdoi123 Oct 17 '19 at 7:47
  • 2
    @sdfdsgfdoi123 You're welcome! As a beginner, learn not to disregard error messages you get during LaTeX runs. For instance, a \begin{bmatrix} command must be inside math mode; in your example code, it isn't. – egreg Oct 17 '19 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.