3

For a one-page bulletin, I need some text and a logo on the end of a page. I've gotten first results with using minipages so far:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{tikz}

\begin{document}

\noindent
\begin{minipage}{0.8\textwidth}
 \begin{center}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut
purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
Curabitur dictum gravida mauris. Nam arcu libero, nonummy
eget, consectetuer id, vulputate a, magna. Donec vehicula
augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo.
\end{center}
\end{minipage}
\hfill
\begin{minipage}{4.5\baselineskip}
\begin{tikzpicture}[scale=2]
 \path[draw] (0,0) rectangle (1,1);
\end{tikzpicture}
\end{minipage}
\end{document}

However, the text is centered along the minipage center, not the original page center. Is there some way to circumvent this, for example with an optional argument to centering?

2

I guess you want to measure what's the width of the TikZ picture, add some padding (here the same used between columns in tabular):

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{showframe}

\newsavebox{\finallogobox}
\newlength{\finallogowd}

\newcommand{\finallogo}{%
  \sbox{\finallogobox}{%
    \begin{tikzpicture}[scale=2]
    \path[draw] (0,0) rectangle (1,1);
    \end{tikzpicture}%
  }%
  \setlength{\finallogowd}{\textwidth}%
  \addtolength{\finallogowd}{-2\wd\finallogobox}%
  \addtolength{\finallogowd}{-4\tabcolsep}%
  \noindent
  \phantom{\usebox{\finallogobox}}%
  \hfill
  \begin{minipage}{\finallogowd}
    \centering
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut
    purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
    Curabitur dictum gravida mauris. Nam arcu libero, nonummy
    eget, consectetuer id, vulputate a, magna. Donec vehicula
    augue eu neque. Pellentesque habitant morbi tristique senectus
    et netus et malesuada fames ac turpis egestas. Mauris ut leo.
  \end{minipage}%
  \hfill
  \begin{tabular}{@{}c@{}}
  \usebox{\finallogobox}
  \end{tabular}\par
}


\begin{document}

\finallogo

\end{document}

The showframe package is used only to clearly see the final effect. The tabular around the picture is for vertically centering it with respect to the text.

enter image description here

1

I got a solution using only one TikZ-picture. I used some code from zeroth, see here.

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{tikz}

% Defining a new coordinate system for the page:
%
% --------------------------
% |(-1,1)    (0,1)    (1,1)|
% |                        |
% |(-1,0)    (0,0)    (1,0)|
% |                        |
% |(-1,-1)   (0,-1)  (1,-1)|
% --------------------------
\makeatletter
\def\parsecomma#1,#2\endparsecomma{\def\page@x{#1}\def\page@y{#2}}
\tikzdeclarecoordinatesystem{page}{
    \parsecomma#1\endparsecomma
    \pgfpointanchor{current page}{north east}
    % Save the upper right corner
    \pgf@xc=\pgf@x%
    \pgf@yc=\pgf@y%
    % save the lower left corner
    \pgfpointanchor{current page}{south west}
    \pgf@xb=\pgf@x%
    \pgf@yb=\pgf@y%
    % Transform to the correct placement
    \pgfmathparse{(\pgf@xc-\pgf@xb)/2.*\page@x+(\pgf@xc+\pgf@xb)/2.}
    \expandafter\pgf@x\expandafter=\pgfmathresult pt
    \pgfmathparse{(\pgf@yc-\pgf@yb)/2.*\page@y+(\pgf@yc+\pgf@yb)/2.}
    \expandafter\pgf@y\expandafter=\pgfmathresult pt
}
\makeatother

\begin{document}

\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\node[draw,text width=.6\paperwidth] at (current page.center) {
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo.};
\draw[thick] (page cs:-.2,-.8) rectangle (page cs:.2,-.6);
\end{tikzpicture}
\end{document}

Produces the following output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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