1

the minipage i am creating should start at the end of the hyphen but it goes down by one line--why?--how to get the alignment with the hyphen?

\documentclass{article}
\usepackage{mwe}        % or load ’ graphicx ’ and ’ b l ind tex t ’ manually
\begin{document}
\blindtext

\blindtext\\
\raggedright {\underline {Shri Peter J, PScO/ SA Wing   }} --\hspace{1pt} \begin{minipage} [t][2cm][t]{1\textwidth}
    Please intimate the progress of the Board wef 13 May 2019 onwards for the info of Controller. On file.
\end{minipage}
\end{document}
  • 1
    Try 0.5\textwidth as a width for your minipage because by using 1\textwidth it is forced bellow the rest of the line – koleygr Sep 21 '19 at 8:32
  • 0.5 works--thanks – js bibra Sep 21 '19 at 8:57
  • Underfull \hbox (badness 1478) in paragraph at lines 156--157 --why do i get the above error? after changing to 0.5--any other alternative to minipage? – js bibra Sep 21 '19 at 8:58
  • 1
    Check my answer... (I used the whole width in my answer) ... But this is not an error ... it is a warning – koleygr Sep 21 '19 at 9:03
1

Try this:

\documentclass{article}
\usepackage{mwe}        % or load ’ graphicx ’ and ’ b l ind tex t ’ manually
\newsavebox{\mybox}
\newlength{\restofline}
\begin{document}
\blindtext

\blindtext\\
\savebox\mybox{\hbox{\underline {Shri Peter J, PScO/ SA Wing } --\hskip 1pt}}
\noindent\usebox{\mybox}
\setlength{\restofline}{\dimexpr\textwidth-\wd\mybox-10pt\relax}
\begin{minipage} [t]{\restofline}
    Please intimate the progress of the Board wef 13 May 2019 onwards for the info of Controller. On file.
\end{minipage}
\end{document}

Explaining:

I saved in an \hbox named \mybox the width of the initial text in order to calculate it's width and use it later to find the \restofline width.

Then the minipage, used all the next width (but had to reduce it slightly because of minipage's outer sep)

| improve this answer | |
  • \setlength{\restofline}{\dimexpr\textwidth-\wd\mybox-10pt\relax}---------which book can I get such expressions from? – js bibra Sep 22 '19 at 0:08
  • 1
    @jsbibra ... I haven't read any book about LaTeX yet but I suggest to read the TeXbook and then source2e documentation. (I will do too). My knowledge is gained mostly here by trying to help people oslve some LaTeX problems. – koleygr Sep 22 '19 at 7:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.