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 think I have seen this done before, but I am not sure. Is there a way to build a fake figure in LaTeX? I would like to do this while the other figures in the document render correctly.

Ideally, I would like to have a white box with large text in it, and with a black frame around it. It would be great to be able to control the height and width of this box.

E.g.

\begin{figure}[!t]
\centering
%% Code to make a fake text box
\caption{}
\label{}
\end{figure}

I am loading TikZ in the document, so I can use solutions that may require it.

share|improve this question

4 Answers 4

up vote 4 down vote accepted

A simple way to do this is to use \fbox{Dummy} with a \resizebox{<width>}{<height>}{<content>}. Maybe playcing the \fbox on the outside.

It is even easier and more flexible with my adjustbox package, e.g.:

\adjustbox{margin=1em,width=.9\textwidth,set height=10cm,frame,center}{Dummy}

\documentclass{article}
\usepackage{adjustbox}
\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{figure}[!t]
    \centering
    \adjustbox{margin=1em,width=\textwidth,set height=4cm,set depth=4cm,frame,center}{Dummy}
    \caption{Dummy}
    \label{fig:dummy}
\end{figure}


\lipsum[2-3]

\end{document}

Result

share|improve this answer
1  
If multi-line text is required add e.g. a minibox=<width> or similar key at the very beginning. –  Martin Scharrer Mar 29 '12 at 18:28

My approach is very similar to my solution for this http://tex.stackexchange.com/a/44199/10570 . It uses the picins package.

\documentclass{book}
\usepackage{picins}

\def\pictureBox#1#2#3{%
    \parpic(#1,#2)[d]{#3}\picskip{0}%
}%


\begin{document}
\begin{figure}
\centering
    \pictureBox{8cm}{5cm}{Here is the text.}
    \caption{My placholder}
\end{figure}
\end{document}
share|improve this answer

Here's a way: an \fbox containing invisible rules as high and wide as specified

\newcommand{\fakebox}[2]{% #1 = width, #2 = height
  {\fboxsep=-\fboxrule\fbox{\rule{0pt}{#2}\rule{#1}{0pt}}}}

\fakebox{3cm}{2cm}

The initial setting will add no additional width or height due to the borders.

Adding a word is not difficult: I would never use a large word, just a small one in a corner to make clear that this is only a placeholder

\newcommand{\fakebox}[2]{% #1 = width, #2 = height
  {\fboxsep=-\fboxrule\fbox{\makebox[0pt][r]{\kern2\fboxrule\tiny dummy}%
     \rule{0pt}{#2}\rule{#1}{0pt}}}}
share|improve this answer
    
There is a \phantombox{<width>}{<height>}{<depth} macro provided by adjustbox, which could be placed in a \frame or \fbox. You can also reduce the dimensions to compensate for the frame rule width and separation. –  Martin Scharrer Mar 29 '12 at 18:03

Another way could be using a \fbox to frame a \parbox (using the second optional argument you can control the height):

\documentclass{article}

\newcommand\FramedBox[3]{%
  \setlength\fboxsep{0pt}
  \fbox{\parbox[t][#1][c]{#2}{\centering\huge #3}}}

\begin{document}

\FramedBox{4cm}{4cm}{Some text}

\FramedBox{2cm}{8cm}{Some text}

\end{document}

enter image description here

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.