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.

I want to insert a symbol (\Box) at the end of the line.

share|improve this question
13  
If you're doing this to denote the end of a proof, consider using the proof environment. –  TH. Mar 7 '11 at 6:50
3  
it would help us to answer better if you could give us a bit more detail of what you're trying to achieve. For example, one possible (though unlikely) answer would be to use \marginpar. –  Brent.Longborough Mar 7 '11 at 9:52

3 Answers 3

Simply use \hfill before \Box:

\documentclass{article}
\usepackage{latexsym}
\begin{document}
Text\hfill\(\Box\)
\end{document}

Edit: To clarify a bit regarding the comments: this simple command is intended as an answer to the simple question, how to insert a symbol at the end of the line.

The mentioned \Box may lead to the assumption, that the question might be about a proof. The highly upvoted comment of TH. still awaits an answer by the questioner. In the case of a proof it's strongly recommended to use

  • amsthm with its proof environment, mentioned by TH., daleif, and Barbara, or

  • ntheorem with proper placement of such endmarks even after a displayed math environment or a list.

The answers to Theorem packages: which to use, which conflict? can help in deciding which to use.

share|improve this answer
3  
If this is used as an end of proof marker, then this is a really bad idea. Use the proof environment from the amsthm package or if outside a proof, use \qed from the same package. –  daleif Mar 7 '11 at 11:56
    
@daleif: Having read the source I'm aware that the amsthm implementation of \qed is much more complicated than a simple \hfill. So I guess when you say "bad", you mean "prone to unexpected behavior", right? Could you elaborate on that? –  Matthew Leingang Mar 7 '11 at 12:55
    
@Mathew: Could that be "bad" as in "reinventing the wheel when you wanted a kettle"? IMNSHO, OP needs to clarify what he's trying to do in the problem domain, such as "I want to mark the end of a paragraph" or whatever, rather than in the solution domain, such as "I want to decorate my line with a blob" –  Brent.Longborough Mar 7 '11 at 14:17
    
@Matthew: simple, what happens if your text is exactly the same length as your text width? Then \hfill is lost and \Box is at the start of the next line, or you may even end up with the box as being the first thing on the next page. I usually call it the \helmos construction as is seen in many journal templates. It is a stupid solution and should not be used, especially when a better solution exist. –  daleif Mar 8 '11 at 13:25
2  
@daleif: That explains it very well. But I don't think it's necessary to call others' answers stupid. Obviously Stefan's a mod and a big boy so he can take the criticism but we try to keep things supportive here. Each answer is voted on and usually the best ones rise to the top. –  Matthew Leingang Mar 8 '11 at 14:26

here is a comment repeated from question 3799 which asked about putting "boxes" (or other symbols) at the ends of either text lines or displayed equations. although the direct relevance is to amsthm, the approach should be workable in other contexts as well.

it was not originally recognized that "boxes" would be wanted at the end of anything other than proofs, but over the past year there have been numerous requests for this facility. a wholesale upgrade of this feature, including adding the ability to mark non-proofs, is on our to-do list. in the meantime, see “Theorems in AMS-LaTeX” in the ams author faq. it contains a link to an example file that demonstrates various tactics that can be used with amsthm to get different symbols and put them in different locations.

share|improve this answer

A related issue concerns inserting a symbol at the end of a displayed equation. E.g., if one has a specific symbol for the end of a remark or definition, and the remark or definition ends with a displayed equation. (Placement of the qed symbol at the end of a proof with a displayed equation is easy---simply add the command \qedhere at the end of the equation.) One option is to do something like

\begin{flalign*}
    && <equation> && <symbol>
\end{flalign*}

Just thought I'ld mention this one here...

share|improve this answer

Your Answer

 
discard

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