TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following macro

\mainlanguage   [de]

        {\startalignment [flushleft] #1 \stopalignment \startalignment [flushright] (\bf Test Message) \stopalignment}

\Test[This one is correct, correct, correct, correct, correct.]
This one is wrong, wrong, wrong, wrong, wrong.
\startalignment [flushright] 
(\bf Test Message) 


with three examples. What I want is this:

\Test[#1] should produce #1 and #2 with the following properties:

  • #1 should be flushleft, #2 flushright
  • #2 should never be breaked into two lines
  • if they fit into one line, then they should do that, not like the above first example

How to do that?

share|improve this question
What if #1 or #2 is larger than a line? What if #1 + #2 is larger than a line. If you ignore these cases then \hbox to \textwidth{#1 \hfill #2} should work. – Aditya Nov 1 '12 at 16:28
The only precondition is: #2 is smaller than a line. But #1 may be much larger, in any cases #1 should be flushleft and #2 should be flushright. And #2 should be in the last line of #1, if there is space for it. If not, then #2 has to be in the next line. – Mustafa Nov 2 '12 at 11:47
Are you trying to write attribution for quotes? Simply using \wordright{#2} should be sufficient. – Aditya Nov 2 '12 at 12:25
Indeed, that is it! – Mustafa Nov 2 '12 at 14:43

I am using the annotation module for a better key-value driven syntax (although you can also use \definestartstop). You can use \wordright{...} to place a word on the right. For example:






\input ward

\startQuote[title={Donald Knuth}]
  \input knuth

\input ward



enter image description here

share|improve this answer

Your Answer


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.