Graphics, Figures & TablesDraw line in a Matrix Equation

Information and discussion about graphics, figures & tables in LaTeX documents.
wolfrain
Posts: 20
Joined: Wed Aug 25, 2010 2:42 am

Draw line in a Matrix Equation

Post by wolfrain »

achim wrote:Where did you put them and on what system are you on? Are you using Miktex?

You need to update the file name database after installing new packages in order for LaTeX to know about them. If you're using Miktex, installing new packages is easy. You won't need to download them form the website, just use the package manager from MikTex. After that go to Start/Programs/Miktex/Maintainance/Settings (might be slightly different) and press 'Refresh FNDB' and 'Update Formats' in the General tab.
If you're lucky and you are using linux the packages in question should already be included in texlive.
Thank you!
As I said, I am using TeXnicCenter on Windows 7 in our school. Does it share the same MikTex package manager things? I don't see any TeXnicCenter package manager specifically for TeXnicCenter. If I update the package in the way like you said, will it take effect for TeXnicCenter?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

wolfrain
Posts: 20
Joined: Wed Aug 25, 2010 2:42 am

Draw line in a Matrix Equation

Post by wolfrain »

Hey,

Finally I fixed all those errors!

I put the \usepackage{etex} immediately after the \documentclass{} and it works well!

But another error turns up... sadly...

Code: Select all

\begin{figure}[!ht]
  \begin{center}
%    \includegraphics[scale=0.3]{materials/2D-core.png}
%    \includegraphics[0.3cm, 0.3cm][1.3cm, 1.3cm]{materials/2D-core.png}
    \includegraphics[scale=0.3]{materials/Diagrams.eps}
	\end{center}
  \caption{111111}
  \label{123}
\end{figure}
As you can see, I have three different lines for including graphics.

The first commented line is able to import the 2D-core.png, but the picture overlaps the context above it... and compiler says there is an error in BoundingBox.

The second commented line where I specify the BoundingBox works and no error occurs, but still the figure overlaps the context above it...

The third line works perfectly, and I think maybe it is due to the figure I include is .eps, which is fully supported by LaTex. But usually I prefer to draw my figures in Microsoft Visio, and it, however, doesn't output .eps or .ps file at all... How can that be solved??

Thank you in advance.
wolfrain
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Draw line in a Matrix Equation

Post by gmedina »

Hi,

use epstopdf to convert the EPS image to PDF format and compile using pdflatex and not latex.

Edit: now that I see that you are using some PS-Tricks code, you'll have to use the pst-pdf or the pdftricks packages to be able to compile with pdflatex.

Another option would be to use only images in EPS format.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

Draw line in a Matrix Equation

Post by achim »

As I said, I am using TeXnicCenter on Windows 7 in our school.
Sorry, must have over read this.

Two things concerning the \includegraphics command:
  • When compiling the dvi-ps way, LaTeX assumes that your image file is an eps and you don't have to specify it.
  • The width or height of an image can be specified as an absolute dimension with a unit, or relative to the paperwidth.
So you might include your graphics as follows.
\includegraphics[width=10cm]{materials/Diagrams} % aspect ratio is maintained if you just specify either the width or the height
\includegraphics[width=0.8\linewidth]{materials/Diagrams}
This is convenient because it is easy to have a consistent figure appearance throughout the document. Or if you want two figures side by side, just make sure they have the same height.
use epstopdf to convert the EPS image to PDF format and compile using pdflatex and not latex.
No, not when you work with psticks graphics that is. Pstricks needs to 'walk the dvi ps path'...
There is tons of png to eps converters out there. Alternatively, you could of course also use GIMP or the like.

EDIT:
Edit: now that I see that you are using some PS-Tricks code, you'll have to use the pst-pdf or the pdftricks packages to be able to compile with pdflatex.

Another option would be to use only images in EPS format.
Cool, I wasn't aware that pdftricks allows you to compile directly to a pdf. Still, I'm sticking to dvi ps. It just works too well to give it up, and I quite value the quality of eps.
OS: Kubuntu
Distribution: TexLive
Editor: Kile
wolfrain
Posts: 20
Joined: Wed Aug 25, 2010 2:42 am

Draw line in a Matrix Equation

Post by wolfrain »

gmedina wrote:Hi,

use epstopdf to convert the EPS image to PDF format and compile using pdflatex and not latex.

Edit: now that I see that you are using some PS-Tricks code, you'll have to use the pst-pdf or the pdftricks packages to be able to compile with pdflatex.

Another option would be to use only images in EPS format.
Could you explain what's the difference of compilation options between TeXnicCenter and MikTex (Texworks)??

For TeXnicCenter, it hasLaTeX => DVI, LaTeX => PDF, LaTeX => PS, LaTeX => PS => PDF; on the other hand, MikTex has pdfTex, pdfLaTex, XeTex, XeLaTex. (and I think MakeIndex and BibTex are specifically for Contents of Table and Bibliography respectively)

I am a little bit confused with them... :oops:


EDIT: Provided that I am using pstricks, if I want to directly import PDF graphic into my work, what should I do??
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Draw line in a Matrix Equation

Post by gmedina »

wolfrain wrote: ...Could you explain what's the difference of compilation options between TeXnicCenter and MikTex (Texworks)??

For TeXnicCenter, it hasLaTeX => DVI, LaTeX => PDF, LaTeX => PS, LaTeX => PS => PDF; on the other hand, MikTex has pdfTex, pdfLaTex, XeTex, XeLaTex. (and I think MakeIndex and BibTex are specifically for Contents of Table and Bibliography respectively)
TeXnicCenter profiles:
1) LaTeX => DVI: uses latex to compile the document and produces a .dvi file from your .tex code.
2) LaTeX => PDF: uses pdflatex to compile the document and produces a .pdf file directly from your .tex code.
3) LaTeX => PS: uses latex to compile the document, internally uses dvips, and produces a .ps file from your .tex code.
4) LaTeX => PS => PDF: same as before, but aditionally calls ps2pdf internally, and produces a .pdf file from your .tex code.
wolfrain wrote: ...EDIT: Provided that I am using pstricks, if I want to directly import PDF graphic into my work, what should I do??
Here are the instructions to be able to compile directly with pdflatex when using PS-Tricks code and EPS images, with the help of the pdftricks (link provided in my previous response) package :

1) In the preamble, load the package:

Code: Select all

\usepackage{pdftricks}
2) In the preamble, load the epstopdf package (to convert on the fly the EPS figures to PDF format):

Code: Select all

\usepackage{epstopdf}
3) In the preamble, enclose all the \usepackage commands associated with PS-Tricks packages using \begin{psinputs}...\end{psinputs} (see example below)

4) Enclose each pspicture environment along with any macro code within a pdfdisplay environment.

5) Compile using pdflatex: if shell scape is active in your system (most surely it is not), the compilation will produce the desired result; if not, you'll get a warning like this one:

Code: Select all

Package pdftricks Warning: ****************************************
(pdftricks)                No \write 18 capability.
(pdftricks)                You'll have to run a script by yourself!
(pdftricks) 
in that case, you will have to compile from a terminal, using

Code: Select all

pdflatex -shell-scape your-file.tex
A sample code:

Code: Select all

\documentclass{article}
\usepackage{pdftricks}
\begin{psinputs}
\usepackage{pst-all}
\end{psinputs}

\begin{document}
  
\begin{pdfdisplay}
\begin{pspicture}(-6,-6)(6,6)
\psaxes{<<->>}(0,0)(-6,-6)(6,6)
\psset{arrows=->>}
\multido{\ia=-5+1}{11}{%
\multido{\ib=-5+1}{11}{%
\pstVerb{/x \ia\space def
/y \ib\space def
y 0 eq
{/ValueTempA 0 def
/ValueTempB 0.5 def}
{/ValueTempZ 2 1 x x mul y y mul div add sqrt mul def
/ValueTempA 1 ValueTempZ div def
/ValueTempB x y ValueTempZ mul div def}
ifelse}
\psline(! x ValueTempA sub y ValueTempB sub)
(! x ValueTempA add y ValueTempB add)}}
\end{pspicture}
\end{pdfdisplay}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply