Text Formatting ⇒ character count
-
- Posts: 9
- Joined: Mon Nov 09, 2009 6:14 pm
character count
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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: character count
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.
-
- Posts: 9
- Joined: Mon Nov 09, 2009 6:14 pm
Re: character count
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
-
- Posts: 9
- Joined: Mon Nov 09, 2009 6:14 pm
character count
Code: Select all
\hspace*{\fill} \mbox{5 P.}\\
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
character count
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
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10