Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've got an image created with psmatrix code and I would like to put it at 1/4 of the text width. Using \centering in the image environment it gets too far to the right.

I'm sorry but my code is a mess ;)

\documentclass{article}
\usepackage[italian]{babel}

\usepackage{pst-node}
\usepackage{caption}
\usepackage[showframe=true]{geometry}

\begin{document}
 \begin{figure}[htbp] 
\psscalebox{1}{
$
  \begin{psmatrix}[framesep=5pt,colsep=2cm]
      & \psframebox[]{SET~T_1} \\
        \psframebox[]{SET~T_2} & \psframebox[]{IMT}\\
       & \psframebox[]{SEM}
     \psset{arrows=->,nodesep=5pt}
      \ncline{1,2}{2,2}
      \naput{\textit{flusso di energia chimica}}\nbput{\begin{minipage}{1.5cm}\begin{center}\boldmath{$\dot{m}_cH_i$ }\end{center}\end{minipage}}
        \ncline{2,2}{2,1}\nbput{\textit{perdite}}
      \ncline{2,2}{3,2}
      \naput{\textit{potenza meccanica utile all'asse}}\nbput{\begin{minipage}       {1.5cm}\begin{center}\boldmath{$P_u$ }\end{center}\end{minipage}}
  \end{psmatrix}
     $}
    \end{figure}
\end{document}
share|improve this question
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. –  Marco Daniel Apr 16 '12 at 10:39
    
You can try \hspace*{0.25\linewidth} –  Marco Daniel Apr 16 '12 at 10:40
    
You could get 1/4 centering to the left using: \noindent\leavevmode\hbox to \linewidth{\hss\hbox{<psmatrix code>}\hss\hss\hss}, but maybe a more high-level way would be better. –  Martin Scharrer Apr 16 '12 at 10:45
    
@MartinScharrer: I think using \makebox is more elegant. –  Marco Daniel Apr 16 '12 at 11:03

1 Answer 1

I will try to answer this question.

Sidenote: You MWE is too long. You loaded packages which aren't related to your question. Please avid this.

End Sidenote

The width of the environment psmatrix based on the contents. To start the environment 0.25\textwidth of the left margin you can simple use \hspace*{0.25\linewidth}. That is shown in the example below. The next option (also shown) you can use the command \makebox with the following syntax:

\makebox[<width>][<inner alignment>]{<content>}

With the command \makebox you can align the environment at the center.

The package adjustbox provides more possibilities.

To demonstrate the result I used the option showframe.

\documentclass[a4paper,12pt]{article}
\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{amsmath}
\usepackage{geometry}
\geometry{a4paper,top=2cm,bottom=2cm,left=2.0cm,right=2.0cm,heightrounded,bindingoffset=5mm}
\geometry{showframe}
\begin{document}
 \begin{figure}[htbp] 
\hspace*{0.25\linewidth}%
\makebox[0pt][c]{\psscalebox{1}{
$%
  \begin{psmatrix}[framesep=5pt,colsep=2cm]
      & \psframebox[]{SET~T_1} \\
        \psframebox[]{SET~T_2} & \psframebox[]{IMT}\\
       & \psframebox[]{SEM}
     \psset{arrows=->,nodesep=5pt}
      \ncline{1,2}{2,2}
      \naput{\textit{flusso di energia chimica}}\nbput{\begin{minipage}{1.5cm}\begin{center}\boldmath{$\dot{m}_cH_i$ }\end{center}\end{minipage}}
        \ncline{2,2}{2,1}\nbput{\textit{perdite}}
      \ncline{2,2}{3,2}
      \naput{\textit{potenza meccanica utile all'asse}}\nbput{\begin{minipage}       {1.5cm}\begin{center}\boldmath{$P_u$ }\end{center}\end{minipage}}
  \end{psmatrix}
     $}}
 \end{figure}
  \begin{figure}[htbp] 
\hspace*{0.25\linewidth}%
 \psscalebox{1}{
$%
  \begin{psmatrix}[framesep=5pt,colsep=2cm]
      & \psframebox[]{SET~T_1} \\
        \psframebox[]{SET~T_2} & \psframebox[]{IMT}\\
       & \psframebox[]{SEM}
     \psset{arrows=->,nodesep=5pt}
      \ncline{1,2}{2,2}
      \naput{\textit{flusso di energia chimica}}\nbput{\begin{minipage}{1.5cm}\begin{center}\boldmath{$\dot{m}_cH_i$ }\end{center}\end{minipage}}
        \ncline{2,2}{2,1}\nbput{\textit{perdite}}
      \ncline{2,2}{3,2}
      \naput{\textit{potenza meccanica utile all'asse}}\nbput{\begin{minipage}       {1.5cm}\begin{center}\boldmath{$P_u$ }\end{center}\end{minipage}}
  \end{psmatrix}
     $}
  \end{figure}
\end{document}

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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