Discussion:
how crop a box?
(too old to reply)
AikidoGuy
2008-12-11 23:11:49 UTC
Permalink
Hello All,

I've done a search of comp.text.tex anad ctan, but I can't find what I
need.

I know that:
1) There is a macro that can resize what is inside
\resizebox{\columnwidth}{!}{...}
2) There is macro that can make a box of a size you specify
\makebox[\columnwidth][l]{...}
3) There is a macro that can do the same as (2) but with a frame
around it
\framebox[\columnwidth][l]{...}

Is there a macro to crop? That is, if I have a box, is there a macro
that
I could apply to the box that would give me a piece of the box?

Thanks for any tips!
Werner Grundlingh
2008-12-13 15:09:30 UTC
Permalink
Post by AikidoGuy
Hello All,
I've done a search of comp.text.tex anad ctan, but I can't find what I
need.
1) There is a macro that can resize what is inside
     \resizebox{\columnwidth}{!}{...}
2) There is macro that can make a box of a size you specify
      \makebox[\columnwidth][l]{...}
3) There is a macro that can do the same as (2) but with a frame
around it
      \framebox[\columnwidth][l]{...}
Is there a macro to crop? That is, if I have a box, is there a macro
that
I could apply to the box that would give me a piece of the box?
Thanks for any tips!
If the 'box' is an image using \includegraphics[...]{...} you could
specify the viewport option, thereby cropping the image to a new
boundingbox:
\includegraphics*[scale=0.5,viewport=lx ly ux uy]{myimage}% Starred
version required for clipping image

Werner
Heiko Oberdiek
2008-12-13 21:32:42 UTC
Permalink
Post by Werner Grundlingh
\includegraphics*[scale=0.5,viewport=lx ly ux uy]{myimage}% Starred
version required for clipping image
The star is optional, because key `clip' can be used, too. :-)

Yours sincerely
Heiko <***@uni-freiburg.de>
AikidoGuy
2008-12-16 16:34:41 UTC
Permalink
Post by Werner Grundlingh
If the 'box' is an image using \includegraphics[...]{...}
Hi,

Yes, I understood that one. Sorry for not giving it as an example.
My question was for a general box. To be more specific... I use
gnuplot to create a LaTeX picture that I \input{}. The main wrapping
macro seems to be "\begingroup". I don't know anything about it, but
I thought that it might be a "box" that I could \resizebox{}{} or
perhaps,
if such a command exists... to \cropbox{}.

My motivation was because the generated gnuplot image has extra
whitespace that I would like to crop off. Yes, there might be a way to
change an option in gnuplot to fix this problem, but I thought an
"easier"
way would be to use a latex macro (if one existed).

Thanks for any possible tips...
Werner Grundlingh
2008-12-17 15:39:01 UTC
Permalink
Post by AikidoGuy
Hi,
Yes, I understood that one. Sorry for not giving it as an example.
My question was for a general box. To be more specific... I use
gnuplot to create a LaTeX picture that I \input{}. The main wrapping
macro seems to be "\begingroup". I don't know anything about it, but
I thought that it might be a "box" that I could \resizebox{}{} or
perhaps,
if such a command exists... to \cropbox{}.
My motivation was because the generated gnuplot image has extra
whitespace that I would like to crop off. Yes, there might be a way to
change an option in gnuplot to fix this problem, but I thought an
"easier"
way would be to use a latex macro (if one existed).
Thanks for any possible tips...
You mention that you use a Gnuplot IMAGE. Why not then use
\includegraphics[...]{...}?

Depending on your manual expertise with bounding boxes, I would
suggest the following if you have an image with extra whitespace
around it:
[1] Open image in EPS/PS image in Ghostview;
[2] Obtain pixel coordinates of lower left (lx, ly) & upper right
(ux, uy) that would remove the excess whitespace;
[3] Open the image in a text editor like VI/VIM;
[4] Find the %%BoundingBox phrase (usually close to the top of the
file);
[5] Replace the existing set of 4 digits with your 'lx ly ux uy'; and
[6] Include the image like you regularly would using \includegraphics
[...]{...} without any viewport option specified.

Werner
AikidoGuy
2008-12-18 19:04:31 UTC
Permalink
Yes... a very fair question. Here is a much more specific question:

For the "\input{}" command below, how can I crop it? I know that I
can
\resizebox it or \framebox it.

Here is my minimal latex example:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\input{myfile.tex}
\caption{My Caption} \label{figure:my-label}
\end{figure}
\end{document}

Here is a minimal gnuplot example that will create myfile.tex and
myfile.eps.

set terminal epslatex input monochrome header "\\bfseries" size 4in,
4in
set output "myfile.tex"
plot sin(x) with lines t 'Something', cos(x) with lines t
'SomethingElse'


Thanks for any help!
a***@gmail.com
2018-06-06 19:55:29 UTC
Permalink
Post by Werner Grundlingh
Post by AikidoGuy
Hi,
Yes, I understood that one. Sorry for not giving it as an example.
My question was for a general box. To be more specific... I use
gnuplot to create a LaTeX picture that I \input{}. The main wrapping
macro seems to be "\begingroup". I don't know anything about it, but
I thought that it might be a "box" that I could \resizebox{}{} or
perhaps,
if such a command exists... to \cropbox{}.
My motivation was because the generated gnuplot image has extra
whitespace that I would like to crop off. Yes, there might be a way to
change an option in gnuplot to fix this problem, but I thought an
"easier"
way would be to use a latex macro (if one existed).
Thanks for any possible tips...
You mention that you use a Gnuplot IMAGE. Why not then use
\includegraphics[...]{...}?
Depending on your manual expertise with bounding boxes, I would
suggest the following if you have an image with extra whitespace
[1] Open image in EPS/PS image in Ghostview;
[2] Obtain pixel coordinates of lower left (lx, ly) & upper right
(ux, uy) that would remove the excess whitespace;
[3] Open the image in a text editor like VI/VIM;
[4] Find the %%BoundingBox phrase (usually close to the top of the
file);
[5] Replace the existing set of 4 digits with your 'lx ly ux uy'; and
[6] Include the image like you regularly would using \includegraphics
[...]{...} without any viewport option specified.
Werner
First of all, i cant speak and i cant understand and.. i cant writing english very well. So i excuse you for this. I read a lot of comment about this subject. İ dont find thing or i cant understand.

\includegraphics[lx,ly][ux,uy]

Is it mean of?: Put the image when size:(lx,ly) as it will coming left down corner of coordinates be (ux,uy). What is the accepted unit of LaTeX document size? I hope i can tell you. Thanks :)))
Im using winedt 5.5 editor and YAP(Yet another preview) viewer.
Peter Flynn
2018-06-06 21:35:04 UTC
Permalink
Post by a***@gmail.com
Post by Werner Grundlingh
Post by AikidoGuy
Hi,
Yes, I understood that one. Sorry for not giving it as an example.
My question was for a general box. To be more specific... I use
gnuplot to create a LaTeX picture that I \input{}. The main wrapping
macro seems to be "\begingroup". I don't know anything about it, but
I thought that it might be a "box" that I could \resizebox{}{} or
perhaps, if such a command exists... to \cropbox{}.
My motivation was because the generated gnuplot image has extra
whitespace that I would like to crop off. Yes, there might be a way to
change an option in gnuplot to fix this problem, but I thought an
"easier" way would be to use a latex macro (if one existed).
Thanks for any possible tips...
You mention that you use a Gnuplot IMAGE. Why not then use
\includegraphics[...]{...}?
I assumed the OP was not referring literally to a bitmap or vector
image, because of the reference to \input{}...I assumed the "image" was
actually the LaTeX "picture" that is referenced in the same sentence.
Post by a***@gmail.com
Post by Werner Grundlingh
Depending on your manual expertise with bounding boxes, I would
suggest the following if you have an image with extra whitespace
[1] Open image in EPS/PS image in Ghostview;
[2] Obtain pixel coordinates of lower left (lx, ly) & upper right
(ux, uy) that would remove the excess whitespace;
[3] Open the image in a text editor like VI/VIM;
[4] Find the %%BoundingBox phrase (usually close to the top of the
file);
[5] Replace the existing set of 4 digits with your 'lx ly ux uy'; and
[6] Include the image like you regularly would using \includegraphics
[...]{...} without any viewport option specified.
There is very little reason nowadays for using EPS images *in the LaTeX
job* (there are other very good reasons for using them during image
construction, adaptation, or conversion along the way, of course).
Post by a***@gmail.com
First of all, i cant speak and i cant understand and.. i cant
writing english very well. So i excuse you for this. I read a lot of
comment about this subject. İ dont find thing or i cant understand.
You're doing very well!
Post by a***@gmail.com
\includegraphics[lx,ly][ux,uy]
Is it mean of?: Put the image when size:(lx,ly) as it will coming
left down corner of coordinates be (ux,uy).
That should be:
llx,lly = coordinates of the lower left corner
urx,ury = coordinates of the upper right corner
(see
http://mirrors.ctan.org/macros/latex/required/graphics/grfguide.pdf#page=9)
Post by a***@gmail.com
What is the accepted unit of LaTeX document size?
The \includegraphics command lets you use any units (see the list in
http://latex.silmaril.ie/formattinginformation/handj.html#units)
but if the units are omitted, they default to 'bp', which are the Adobe
units used in Postscript and PDF documents.

///Peter
a***@gmail.com
2018-06-06 21:46:14 UTC
Permalink
Post by Peter Flynn
Post by a***@gmail.com
Post by Werner Grundlingh
Post by AikidoGuy
Hi,
Yes, I understood that one. Sorry for not giving it as an example.
My question was for a general box. To be more specific... I use
gnuplot to create a LaTeX picture that I \input{}. The main wrapping
macro seems to be "\begingroup". I don't know anything about it, but
I thought that it might be a "box" that I could \resizebox{}{} or
perhaps, if such a command exists... to \cropbox{}.
My motivation was because the generated gnuplot image has extra
whitespace that I would like to crop off. Yes, there might be a way to
change an option in gnuplot to fix this problem, but I thought an
"easier" way would be to use a latex macro (if one existed).
Thanks for any possible tips...
You mention that you use a Gnuplot IMAGE. Why not then use
\includegraphics[...]{...}?
I assumed the OP was not referring literally to a bitmap or vector
image, because of the reference to \input{}...I assumed the "image" was
actually the LaTeX "picture" that is referenced in the same sentence.
Post by a***@gmail.com
Post by Werner Grundlingh
Depending on your manual expertise with bounding boxes, I would
suggest the following if you have an image with extra whitespace
[1] Open image in EPS/PS image in Ghostview;
[2] Obtain pixel coordinates of lower left (lx, ly) & upper right
(ux, uy) that would remove the excess whitespace;
[3] Open the image in a text editor like VI/VIM;
[4] Find the %%BoundingBox phrase (usually close to the top of the
file);
[5] Replace the existing set of 4 digits with your 'lx ly ux uy'; and
[6] Include the image like you regularly would using \includegraphics
[...]{...} without any viewport option specified.
There is very little reason nowadays for using EPS images *in the LaTeX
job* (there are other very good reasons for using them during image
construction, adaptation, or conversion along the way, of course).
Post by a***@gmail.com
First of all, i cant speak and i cant understand and.. i cant
writing english very well. So i excuse you for this. I read a lot of
comment about this subject. İ dont find thing or i cant understand.
You're doing very well!
Post by a***@gmail.com
\includegraphics[lx,ly][ux,uy]
Is it mean of?: Put the image when size:(lx,ly) as it will coming
left down corner of coordinates be (ux,uy).
llx,lly = coordinates of the lower left corner
urx,ury = coordinates of the upper right corner
(see
http://mirrors.ctan.org/macros/latex/required/graphics/grfguide.pdf#page=9)
Post by a***@gmail.com
What is the accepted unit of LaTeX document size?
The \includegraphics command lets you use any units (see the list in
http://latex.silmaril.ie/formattinginformation/handj.html#units)
but if the units are omitted, they default to 'bp', which are the Adobe
units used in Postscript and PDF documents.
///Peter
Post by a***@gmail.com
Post by Werner Grundlingh
Post by AikidoGuy
Hi,
Yes, I understood that one. Sorry for not giving it as an example.
My question was for a general box. To be more specific... I use
gnuplot to create a LaTeX picture that I \input{}. The main wrapping
macro seems to be "\begingroup". I don't know anything about it, but
I thought that it might be a "box" that I could \resizebox{}{} or
perhaps, if such a command exists... to \cropbox{}.
My motivation was because the generated gnuplot image has extra
whitespace that I would like to crop off. Yes, there might be a way to
change an option in gnuplot to fix this problem, but I thought an
"easier" way would be to use a latex macro (if one existed).
Thanks for any possible tips...
You mention that you use a Gnuplot IMAGE. Why not then use
\includegraphics[...]{...}?
I assumed the OP was not referring literally to a bitmap or vector
image, because of the reference to \input{}...I assumed the "image" was
actually the LaTeX "picture" that is referenced in the same sentence.
Post by a***@gmail.com
Post by Werner Grundlingh
Depending on your manual expertise with bounding boxes, I would
suggest the following if you have an image with extra whitespace
[1] Open image in EPS/PS image in Ghostview;
[2] Obtain pixel coordinates of lower left (lx, ly) & upper right
(ux, uy) that would remove the excess whitespace;
[3] Open the image in a text editor like VI/VIM;
[4] Find the %%BoundingBox phrase (usually close to the top of the
file);
[5] Replace the existing set of 4 digits with your 'lx ly ux uy'; and
[6] Include the image like you regularly would using \includegraphics
[...]{...} without any viewport option specified.
There is very little reason nowadays for using EPS images *in the LaTeX
job* (there are other very good reasons for using them during image
construction, adaptation, or conversion along the way, of course).
Post by a***@gmail.com
First of all, i cant speak and i cant understand and.. i cant
writing english very well. So i excuse you for this. I read a lot of
comment about this subject. İ dont find thing or i cant understand.
You're doing very well!
Post by a***@gmail.com
\includegraphics[lx,ly][ux,uy]
Is it mean of?: Put the image when size:(lx,ly) as it will coming
left down corner of coordinates be (ux,uy).
llx,lly = coordinates of the lower left corner
urx,ury = coordinates of the upper right corner
(see
http://mirrors.ctan.org/macros/latex/required/graphics/grfguide.pdf#page=9)
Post by a***@gmail.com
What is the accepted unit of LaTeX document size?
The \includegraphics command lets you use any units (see the list in
http://latex.silmaril.ie/formattinginformation/handj.html#units)
but if the units are omitted, they default to 'bp', which are the Adobe
units used in Postscript and PDF documents.
///Peter
Really you understand me ::))) Thank you very much. İ will see at links. As a result my english is not so bad (Joke:)) very bad!) good work
Loading...