Text Formattingcharacter count

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
littlemathteacher
Posts: 9
Joined: Mon Nov 09, 2009 6:14 pm

character count

Post by littlemathteacher »

Hi.

I am new to LaTeX.
I need a tool which makes one word be set always at the end of an existing line i.e. always at the right, but not in a column right next to the lines, but underneath them, just as a part of the line. Currently I am using \hfill. But each time the line gets near to its maximum length or to a linebreak the last word (actually it is the marks display in math exams) breaks into the new line and stays in the left corner. Someone told me about \hfill* which still won't work the way I want it to (in fact it doesn't work at all in the compiler I use at monkeytex).
I am thinking about writing a makro using \ifthenelse and evaluating the number of left space in the line resp. the number of characters in the line and the maximum number which might result from the page settings.
Does anyone know how to count the characters after the compiler has already worked the line up to the last word before the current command?
Or to help me out in some other way?

Thanks.
Yours, littlemathteacher.
Last edited by littlemathteacher on Thu Nov 26, 2009 10:11 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

adrian
Posts: 8
Joined: Thu Nov 12, 2009 5:24 pm

Re: character count

Post by adrian »

If I understand your question correctly, it might be easiest to use the
basic tabular environment, and right justify the text in the rightmost
column. Most introductory articles about LaTex should contain enough
information to get you started.
littlemathteacher
Posts: 9
Joined: Mon Nov 09, 2009 6:14 pm

Re: character count

Post by littlemathteacher »

Thanks to adrian.

Isn't your proposal, i.e. using a separate column, the one that puts the word (i.e. the marks counter) right next to the text? I don't want it to appear in a separate column, for I don't want to use so much space on the page for it. Furthermore the page without a separate column for the marks looks much more relaxed to me - more like an article than like math exam.

If I'm not right please put me right. Otherwise: anyone to help me?


Thanks
littlemathteacher
Posts: 9
Joined: Mon Nov 09, 2009 6:14 pm

character count

Post by littlemathteacher »

This is the tool I was looking for:

Code: Select all

\hspace*{\fill} \mbox{5 P.}\\
Found it more or less accidentially.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

character count

Post by localghost »

Code: Select all

\documentclass[english]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{lmodern}
\usepackage{blindtext}

\newcommand*{\signed}[1]{%
  \unskip\hspace*{1em plus 1fill}%
  \nolinebreak[3]\hspace*{\fill}\mbox{#1}
}

\begin{document}
  \blindtext
  \signed{5 P.}
\end{document}

Best regards and welcome to the board
Thorsten
Post Reply