我在我的手稿中使用了两个乳胶构造来围绕需要左对齐的文本绘制一个框架无需改变\parindent
框的前后都有。但都是打印在 的位置\parindent
。
\documentclass[10pt,twoside,toc=listofnumbered,headinclude,footinclude,index=numbered]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[final]{microtype}
\usepackage{blindtext}
\parindent=7mm
\newenvironment{rfbox}{\begin{minipage}{8.0cm}}{\end{minipage}}
\newcommand{\ffbox}[1]{\vspace{0.0cm}{\fbox{\begin{rfbox} #1 \end{rfbox}}}}
\begin{document}
\blindtext\\
\noindent This is left aligned.\\
\fbox{%
\parbox{8cm}{%
\noindent The box around this should be left aligned.
}}\\
\noindent This is also left aligned.\\
\ffbox{
The box around this should also be left aligned.
}\\
\blindtext
\end{document}
答案1
我不确定这个问题,但很tcolorbox
容易生成左对齐的框,因为这是默认行为。
\documentclass[10pt,twoside, toc=listofnumbered, headinclude,
footinclude, index=numbered]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
%\usepackage[final]{microtype}
\usepackage{blindtext}
\parindent=7mm
%\newenvironment{rfbox}{\begin{minipage}{8.0cm}}{\end{minipage}}
%\newcommand{\ffbox}[1]{\vspace{0.0cm}{\fbox{\begin{rfbox} #1 \end{rfbox}}}}
\usepackage[most]{tcolorbox}
\newtcolorbox{mybox}[1][]{
sharp corners, colback=white, boxsep=0mm, boxrule=1pt, #1
}
\begin{document}
\blindtext
\noindent This is left aligned.
\begin{mybox}[width=8cm]
This is also left aligned
\end{mybox}
\noindent This is also left aligned.
\begin{mybox}[width=8cm]
The box around this should also be left aligned.
\end{mybox}
\blindtext
\end{document}
答案2
正如@daleif所说,您可以使用\noindent
之前\fbox
,但是包framed
使您的工作更简单,并且MWE
是:
\usepackage{framed}
\begin{framed}
...
\end{framed}