2

I use rogercortesi.com to convert LaTeX codes into images. But the code I wrote below doesn't work. I couldn't understand why. But the same code works very well here. What is the cause of the problem? Here are codes:

\Delta =\begin{vmatrix} 
  1          &1   &1            &1     &\dots  & 1     \\
  1    &1    &1   &1     &\dots  & 1    \\
  1    &1    &1   &1     &\dots  & 1     \\
  1    &1    &1   &1     &\dots  & 1     \\
   \vdots    &\vdots     &\vdots      &\vdots      &\ddots &\vdots \\  
 1 &1 &1 &1 &\dots  &1    \\
\end{vmatrix} 
  • 3
    “Doesn't work” in what sense? I get the expected image. Anyway, this is off-topic as the sites you mention don't use TeX, but MathJax. – egreg Nov 29 '19 at 10:22
  • Please extend your code fragment to complete small document beginning with \documentclas and ending with \end{document}. Showed code fragment doesn't contain any error. – Zarko Nov 29 '19 at 10:24
  • I am new. I will try to fix my mistakes. – Elementary Nov 29 '19 at 10:30
2

I'd say that while there are several potential reasons for why you're getting errors messages, there are two leading reasons:

  • You failed to embed the expression in a math group -- either inline math or display math.

  • You failed to load the amsmath package, which provides the code for the vmatrix environment you employ.

To wit, the following code compiles fine as a LaTeX document:

\documentclass{article}
\usepackage{amsmath} % for 'vmatrix' environment
\begin{document}
\[ % initiate an unnumbered displaymath group
\Delta =\begin{vmatrix} 
  1      &1      &1      &1      &\dots  & 1     \\
  1      &1      &1      &1      &\dots  & 1     \\
  1      &1      &1      &1      &\dots  & 1     \\
  1      &1      &1      &1      &\dots  & 1     \\
  \vdots &\vdots &\vdots &\vdots &\ddots &\vdots \\  
  1      &1      &1      &1      &\dots  &1
\end{vmatrix} 
\] % terminate the displaymath group
\end{document}

Addendum to address the OP's follow-up question: To create the same output without employing a vmatrix environment, one could write:

\[
\Delta =\left\vert \begin{array}{@{} *{6}{c} @{}}
  1      &1      &1      &1      &\dots  & 1     \\
  1      &1      &1      &1      &\dots  & 1     \\
  1      &1      &1      &1      &\dots  & 1     \\
  1      &1      &1      &1      &\dots  & 1     \\
  \vdots &\vdots &\vdots &\vdots &\ddots &\vdots \\
  1      &1      &1      &1      &\dots  &1      
\end{array} \right\vert
\]

i.e., one would replace \begin{vmatrix} with \left\vert \begin{array}{@{}*{6}{c}@{}} and \end{vmatrix} with \end{array} \right\vert.


Second Addendum: My default browser, Firefox (current version: 70.0.1), displays the following screen when I try to visit rogercortesi.com. I think I'll stay away from this site!

enter image description here

  • Is it possible to write this codes in a different way? I'm trying to convert it to a picture rogercortesi.com. But I can not. – Elementary Nov 29 '19 at 10:49
  • 1
    @Elementary - I'm afraid I'm absolutely unfamiliar with the website you mention. I've posted an addendum to show how one might create the exact same output but without using a vmatrix environment. – Mico Nov 29 '19 at 12:50
  • Thank you very much. This definitely works. – Elementary Nov 29 '19 at 13:09
  • 1
    Following your visit, it turned into a HTTP site which says "This is a test" and "Hello world" :) – WoJ Nov 29 '19 at 19:53
  • 2
    Currently, if I go to the unencrypted site, it works, but if I go to the encrypted site, it claims that the TLS certificate says phpwebhosting.com, not rogercortesi.com. So it’s a configuration error and the webmaster should get a new cert. – Davislor Nov 29 '19 at 21:05
3

You might have forgotten to \usepackage{amsmath} which provides the necessary functions you are using.

I'll post an example where I got it to work - you have to enable math mode as well to access/use these functions (I think? I'm quite new to this as well).

\documentclass[11pt]{article}

\usepackage{amsmath}

\begin{document}
    \[ %enters math mode
    \Delta=\begin{vmatrix}
                1          &1   &1            &1     &\dots  & 1     \\
                1    &1    &1   &1     &\dots  & 1    \\
                1    &1    &1   &1     &\dots  & 1     \\
                1    &1    &1   &1     &\dots  & 1     \\
                \vdots    &\vdots     &\vdots      &\vdots      &\ddots &\vdots \\
                1 &1 &1 &1 &\dots  &1    \\
    \end{vmatrix}
    \]
\end{document}

I can not comment yet, but it would always be helpfulto add the errors you have been seeing in your question, so it's easier to find out what your problem might be. :)

  • I'm trying to convert it to a picture rogercortesi.com But my codes doesnt work. – Elementary Nov 29 '19 at 10:50
  • 1
    Could you provide the error you are getting? What doesn't work in your code? What are your error messages? It's hard to figure out what your problem is without further information. – Jooler Nov 29 '19 at 11:31
  • I think I misread the question. I mean, my code doesn't work on this site. But other codes are all working. rogercortesi.com – Elementary Nov 29 '19 at 12:47

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.