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.

Is there anyway to put text in a page horizontally at a specific position with LaTeX using the prosper class?

After googling, I found that the textpos package can be used to put text in a specific position, but the text is shown vertically. Is there any way to show the text horizontally?

Here is my code:

\documentclass[final,slideBW,total,colorBG]{prosper}

\usepackage[absolute]{textpos}

\title{Test}
\author{Name}
\email{test@test.com}
\institution{XX University}
\begin{document}
\maketitle

\setlength{\TPHorizModule}{30mm}
\setlength{\TPVertModule}{\TPHorizModule}
\begin{slide}{Test Slide}
\begin{textblock}{1}(2,3)
Question
\end{textblock}
\end{slide}

\end{document}

How do I show the text "Question" at a specific position horizontally?

Any help is greatly appreciated.

share|improve this question

migrated from stackoverflow.com Nov 21 '11 at 12:59

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Nov 21 '11 at 19:09
add comment

2 Answers 2

If all you want to do is to position the text horizontally at the current location in the page you can use

\noindent\hspace{<position>}<text>

This is used to produce the first section of the image below.

Alternatively, if you want more flexibility in being able to specify the position as being the center of the text, or the right of the text you can use the \PositionText macro as defined below. It accepts three parameters:

  • An optional alignment specification of either l, c, or r for left, center and right alignment. Defaults to l if not specified.
  • The horizontal position
  • The text

For example, the centered line in the second section of the image below is produced by:

\PositionText[c]{1.0in}{Centered at 1.0in}

enter image description here

Notes:

  • I set the textwidth=3.0in and enabled showframe with the geometry package to make it clear that the text is located at the specified horizontal distance.

Code:

\documentclass{article}
\usepackage[showframe,textwidth=3.0in]{geometry}
\usepackage{xstring}% for string comparrison
\usepackage{calc}%    for \widthof
\usepackage{pgf}%     for math calclations

\newlength{\Size}
\newcommand*{\PositionText}[3][l]{%
    \IfStrEqCase{#1}{%
        {l}{\noindent\hspace{#2}#3}%
        {c}{\pgfmathsetlength{\Size}{#2-0.5*(\widthof{#3})}\noindent\hspace{\Size}#3}%
        {r}{\pgfmathsetlength{\Size}{#2-1.0*(\widthof{#3})}\noindent\hspace{\Size}#3}%
        }[\PackageError{PositionText}
            {\MessageBreak Unrecognized alignment: #1.\MessageBreak 
            Valid alignments are are `l`, `c`, `r'}{}]%
}%

\begin{document}
\noindent\hspace{0.0in}Left point at 0.0in\par
\noindent\hspace{1.0in}Left point at 1.0in\par
\noindent\hspace{2.0in}Left point at 2.0in\par
\noindent\hspace{3.0in}Left point at 3.0in\par

\smallskip\hrule\smallskip
\PositionText{1.0in}{Left point at 1.0in}\par
\PositionText[c]{1.0in}{Centered at 1.0in}\par
\PositionText[r]{3.0in}{Right at 3.0in}\par
\end{document}
share|improve this answer
add comment

The class prosper is really outdated, use powerdot instead:

\documentclass{powerdot}

\title{Test}
\author{Name}
%\email{test@test.com}
%\institution{XX University}
\begin{document}
\maketitle

\begin{slide}{Test Slide}
\rput(2cm,-3cm){Question}
\end{slide}

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

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