-------- Original Message --------
Subject: Fwd: Suggestion: change in LaTeX output rendering
Date: Sun, 22 Jun 2008 22:11:44 -0300
From: Alex <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
References: <[EMAIL PROTECTED]>
Hello, Tim!
I already sent the message below to the /xcircuit-dev/ mailing list, but
it seems to be inactive since january, so I decided to send this e-mail
directly to you. I hope I'm not bothering you.
---------
I'm an Electric Engineering student from Brazil and I've been using
XCircuit for a few months now. Since I've always used LaTeX to typeset
my papers, I found very usefull the LaTeX integration provided by
XCircuit. However, I had a few issues in the beginning when trying to
center align my circuits in the LaTeX document. After a lot of Google
searches (and also within the XCircuit website), the only thing I found
was this:
*Snippet from XCircuit Reference Manual:*
It is important to note several things:
* The graphics appear in the LaTeX document exactly as scaled in
XCircuit. It cannot be resized from within the LaTeX document;
resizing must be done by changing the scale in XCircuit.
* Size of all text is controlled from LaTeX, not from XCircuit.
The scale of all text labels will be the same as all
surrounding text, and can be changed with the usual LaTeX font
sizing commands prior to the \input command.
* Because the XCircuit *.tex* output uses the *epsfig* command,
it is necessary for the LaTeX document to include the *epsfig*
package in its setup section.
It was not very encouraging, I must admit. I didn't give up and found,
in my humble opinion, a very elegant solution that I present to you as a
suggestion for a new rendering output:
_Example of the current output:_
% XCircuit output "/home/alex/fig03.tex" for LaTeX input from
/home/alex/fig03.eps
\def\putbox#1#2#3{\makebox[0in][l]{\makebox[#1][l]{}\raisebox{\baselineskip}[0in][0in]{\raisebox{#2}[0in][0in]{#3}}}}
\def\rightbox#1{\makebox[0in][r]{#1}}
\def\centbox#1{\makebox[0in]{#1}}
\def\topbox#1{\raisebox{-\baselineskip}[0in][0in]{#1}}
\def\midbox#1{\raisebox{-0.5\baselineskip}[0in][0in]{#1}}
\begin{flushleft}
\epsfig{file=/home/alex/fig03.eps}\\
% translate x=1356 y=1356 scale 0.28
\putbox{0.48in}{0.98in}{\rightbox{\midbox{$V_i$}}}%
\putbox{1.48in}{0.73in}{\midbox{$R_B$}}%
\putbox{1.73in}{1.29in}{\centbox{B}}%
\putbox{1.98in}{1.42in}{\centbox{$I_B$}}%
\putbox{2.17in}{0.73in}{\midbox{$\beta r_e$}}%
\putbox{4.17in}{1.29in}{\centbox{C}}%
\putbox{4.54in}{1.42in}{\centbox{$I_C$}}%
\putbox{3.92in}{0.73in}{\midbox{$r_o$}}%
\putbox{4.60in}{0.73in}{\midbox{$R_C$}}%
\putbox{3.23in}{0.73in}{\midbox{$\beta I_b$}}%
\putbox{5.35in}{0.98in}{\midbox{$V_o$}}%
\end{flushleft}
_What I suggest:_
% XCircuit output "/home/alex/fig03.tex" for LaTeX input from
/home/alex/fig03.eps
\def\putbox#1#2#3{\makebox[0in][l]{\makebox[#1][l]{}\raisebox{\baselineskip}[0in][0in]{\raisebox{#2}[0in][0in]{#3}}}}
\def\rightbox#1{\makebox[0in][r]{#1}}
\def\centbox#1{\makebox[0in]{#1}}
\def\topbox#1{\raisebox{-\baselineskip}[0in][0in]{#1}}
\def\midbox#1{\raisebox{-0.5\baselineskip}[0in][0in]{#1}}
\begin{center}
\scalebox{0.90}{%
\normalsize
\parbox{5.86in}{%
\includegraphics{fig03.eps}\\
% translate x=1356 y=1356 scale 0.28
\putbox{0.48in}{0.98in}{\rightbox{\midbox{$V_i$}}}%
\putbox{1.48in}{0.73in}{\midbox{$R_B$}}%
\putbox{1.73in}{1.29in}{\centbox{B}}%
\putbox{1.98in}{1.42in}{\centbox{$I_B$}}%
\putbox{2.17in}{0.73in}{\midbox{$\beta r_e$}}%
\putbox{4.17in}{1.29in}{\centbox{C}}%
\putbox{4.54in}{1.42in}{\centbox{$I_C$}}%
\putbox{3.92in}{0.73in}{\midbox{$r_o$}}%
\putbox{4.60in}{0.73in}{\midbox{$R_C$}}%
\putbox{3.23in}{0.73in}{\midbox{$\beta I_b$}}%
\putbox{5.35in}{0.98in}{\midbox{$V_o$}}%
} % close 'parbox'
} % close 'scalebox'
\vspace{-4.0ex} % this is not necessary, but looks better with it
\end{center}
What I did was to put everything inside a parbox, with the .eps width as
the box width. I also exchanged '\epsfig' whit '\includegraphics' (in my
case it's usefull because I use pdflatex, so I convert my .eps to .pdf
with 'epstopdf'). Those changes alone would improve the current output
since it would be possible to center the drawing in the page. The best
thing about my "code" I think it is the use of 'scalebox', that allows
me to scale the graphics together with the text. That is pretty awesome!
I'm so happy with my solution that I decided to share it! I hope that
everyone like it as much as I did and that it can be incorporated to
XCircuit (since I don't see dificulty to implement the changes, at
first). It's also worth noting that my suggestion sort of solves the
issues reported in the Reference Manual.
Cheers,
Alex Tercete
--
+--------------------------------+-------------------------------------+
| Dr. R. Timothy Edwards (Tim) | email: [EMAIL PROTECTED] |
| MultiGiG, Inc. | web: http://www.multigig.com |
| 100 Enterprise Way, Suite A-3 | phone: (831) 621-3283 |
| Scotts Valley, CA 95066 | cell: (240) 401-0616 |
+--------------------------------+-------------------------------------+
_______________________________________________
Xcircuit-dev mailing list
[email protected]
http://www.opencircuitdesign.com/mailman/listinfo/xcircuit-dev