0

How can I insert the black little square at the end of each question in LaTeX like this picture?

How can I insert the black little square at the end of each question in LaTeX like this picture?

  • 5
    If you're willing to use a theorem-like environment, and amsthm, this question provides a method: https://tex.stackexchange.com/q/201956 – barbara beeton Dec 26 '22 at 21:34

2 Answers2

2

You may find your solution with AMS-theorem extension (short and long docs)

\documentclass{article}
\usepackage{amsthm}
\begin{document}
    \theoremstyle{definition} % default is plain
    \renewcommand{\qedsymbol}{$\blacksquare$} % standard is white
    \newtheorem{myquestion}{Question} % prefix numbering
    \section{Test}
    \begin{myquestion}
        Countries acros the world have been growing persistently since at least year 1200.
    \end{myquestion}
    \begin{myquestion}
        We use a logarithmic scale to plot the graph of a variable.
    \end{myquestion}
\end{document}
gildux
  • 487
1

From Denoting the end of example/remark

\documentclass{article}

\usepackage{amsmath,amsthm}

\providecommand*{\blacksquare}{\rule{1ex}{1ex}}

\theoremstyle{definition} \newtheorem{question}{Question}[section] \AtBeginEnvironment{question}{% \pushQED{\qed}\renewcommand{\qedsymbol}{$\blacksquare$}% } \AtEndEnvironment{question}{\popQED\endquestion}

\begin{document}

\section{First Section}

\begin{question} Countries across the world have been growing persistently since at least year 1200. \end{question}

\begin{question} We use the logarithmic scale to plot the graph of a variable so that the same growth rates at different levels of that variable appear as the same slopes of the graph. \end{question}

\end{document}

Remove [section] if you don't want the counter to be section-dependent.

enter image description here

user94293
  • 4,254