TeX - LaTeX Asked by Mark Tucker on December 14, 2020
My problem is similar to this
Adjust width of algorithm float
However, I want to centre within an item in an enumerated list so I have indentation to the left, so the above Q/A does not centre within space allowing for indentation (it centres in relation to the entire page)
Any ideas on how to centre the minipage within page width allowing for enumeration indenting?
Cheers
Bernard: this is about as minimal as I can get it -- compiling it AND READING THE CONTENT OF THE CAPTIONS will show the exact problem and the solution I tried
documentclass[11pt]{article} usepackage[a4paper, margin=25mm]{geometry} % ,showframe
usepackage{enumerate,color} usepackage{algorithm,algorithmic}
parindent = 0pt parskip = 7.5mm
begin{document}
this is a very long sentence which does nothing other than show how wide text is in normal mode
hrulefill % also shows width
first level starts begin{enumerate}[i)] item indent one level irrelevant text which is just a long sentence to show how wide the acceptable text line is at this level of indenting
second level starts
begin{enumerate}[a)]
item indent second level this is another long sentence which shows how wide the text is in the second level of indent
{color{blue} hrulefill} % shows width in second level of enumerate
begin{algorithm} %[t]
begin{algorithmic}[1]
FOR{$r=0:n-1$}
STATE do stuff
ENDFOR
end{algorithmic}
caption{ this is an example of my problem -- {color{blue}I want this centered in within the blue line} (if you look, the left side start to the left of the indented text ldots{} and that is just stupid)}
end{algorithm}
{color{blue} hrulefill} % shows width in second level of enumerate
begin{figure}[h]
centering
begin{minipage}{0.65hsize} % 0.65 is excessive, but shows the non-helpfulness of the quoted example (maybe set to 0.90)
begin{algorithm}[H] % to get the algorithm in the minipage, the H __must__ be upper!
begin{algorithmic}[1]
FOR{$r=0:n-1$}
STATE do stuff
ENDFOR
end{algorithmic}
caption{this is the adjustment (per the example quoted) but the centering is still not in the middle of the blue lines -- it is centered at the middle of the black lines ldots{} and that is only marginally less stupid
}
label{cCG8tM1HX}
end{algorithm}
end{minipage}
end{figure}
{color{blue} hrulefill} % shows width in second level of enumerate
item next item at second level with same long sentence which shows how wide the text is in the second level of indent
end{enumerate}
item next item at first level with same long sentence which shows how wide the text is in the second level of indent
end{enumerate}
back to original level
hrulefill % shows width
end{document}
Answered by Mark Tucker on December 14, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP