如何创建没有缩进和右对齐的文本的良好大小写区分

如何创建没有缩进和右对齐的文本的良好大小写区分

如何才能创建混合文本(和潜在的数学环境)的良好大小写区分,该混合文本是数字(例如,使用 i,ii,...)并且没有缩进,即所有文本都应在右侧对齐?

\documentclass[15pt, a4paper]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}       
\usepackage{enumitem}   
\begin{document}

\begin{enumerate}[i)]
    \item Case $\Phi < 0$: Fishing-out problem (most obvious inventions first), $\dot A_i$ decreases , with $A \uparrow$, difficulty of innovation increases with state of the art of an economy
    \item Case $\Phi  = 0$: no external effects
    \item Case $\Phi > 0$: positive external effects predominate - $\dot A_i$ increases with $A \uparrow$ - fundamental research with high spillover effects (differential calculus, electricity, semiconductors)
\end{enumerate}
\end{document}

任何文本都不应在橙色线之前开始。橙色线应放置在与最长的 case-name 相关的位置。实现此目的的最短方法是什么?谢谢

在此处输入图片描述

好的,让我介绍一下我使用过的一个较旧的解决方法:表格环境解决了缩进问题。但枚举需要手动完成,而且这仍然看起来不太好:

\begin{center}
\begin{tabular}{l p{15cm} }
$1.) \rho > 0$                  & time preference rate \\
$2.) d(j, \omega, t)$   & demanded quantity of goods of quality level $j$ of industry $\omega$ at time $t$ \\
$3.) \sum_{j=0}^\infty$ & all available quality levels $j$ of a consumer good $\omega$ can be consumed at the same time (\underline{in principle}) $\rightarrow$ however: only consumption of those goods with best quality adjusted price \\
\end{tabular}
\end{center}

在此处输入图片描述

现在,单元格之间的行距太小,数字 1.)、2.) ... 之间的水平间距也太小。希望您有另一个好主意 :)

答案1

版本 2(+嵌套级别)

我继续进行这些小实验。我在计算部分(虚拟排版)中添加了内部环境的消除(\def\newenumerate{\def\item{}}\def\endnewenumerate{})。此消除是在本地组中完成的,因此实际排版正常且不受影响。此代码片段在以下情况下效果最佳:

  • newenumerate使用环境,
  • 缩进的文本块以冒号结尾。

我附上了一个例子和结果预览。

% *latex mal-enumerate.tex
\documentclass[a4paper]{scrartcl}
\pagestyle{empty}
\usepackage{amsmath,amssymb,stmaryrd}       
\usepackage{enumerate}   
\usepackage{environ}

\begin{document}
\let\olditem=\item
\let\oldenumerate=\enumerate
\let\endoldenumerate=\endenumerate
\newdimen\maldimen

\NewEnviron{newenumerate}[1][i)]{%
   % measuring a distance
   \begingroup
   \maldimen=0pt%
   \def\newenumerate{\def\item{}}% elimination of inner env.
   \def\endnewenumerate{}% elimination of inner env.
   \def\item##1: {\setbox0=\hbox{\ ##1: }%
      \ifnum\maldimen<\wd0%
         \global\maldimen=\wd0%
         \fi%
      }% redefinition of \item
   \setbox1=\hbox{\BODY}%
   \endgroup % end of measuring a distance
   % an original enumerate
   \def\item##1: {\olditem \makebox[0pt][r]{##1: }}%      
   \oldenumerate[#1]% its begin
   \labelsep=\maldimen
   \leftskip=\maldimen
   \labelwidth=\maldimen
   \BODY % a set of \items...
   \endoldenumerate% its end
   }
%\makeatother   

Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. 
\begin{newenumerate}[i)]
    \item Case $\Phi < 0$: Fishing-out problem (most obvious inventions first), $\dot A_i$ decreases , with $A \uparrow$, difficulty of innovation increases with state of the art of an economy
    \item Case $\Phi  = 0$: no external effects
\begin{newenumerate}[a)]
\item A: a no external effects no external effects no external effects no external effects no external effects
\item B: b
\item C: c
\begin{newenumerate}[I)]
\item IA: a no external effects no external effects no external effects no external effects no external effects
\item IB: b
\item IC: c
\end{newenumerate}    
\end{newenumerate}    
    \item Case $\Phi > 0$: positive external effects predominate - $\dot A_i$ increases with $A \uparrow$ - fundamental research with high spillover effects (differential calculus, electricity, semiconductors)
\end{newenumerate}

\begin{newenumerate}[i)]
\item A part: a
\item B part: some text to be displayed  some text to be displayed  some text to be displayed  some text to be displayed 
\item C block: c
\end{newenumerate}

\end{document}

示例 2


版本 1(旧版本;仅适用于第一级环境)

这是一个实验。我曾尝试解决类似的问题问题今天通过重新定义itemize环境。这是对案例的改编enumerate。它对我有用,但仅适用于第一级环境。

% *latex mal-enumerate.tex
\documentclass[a4paper]{scrartcl}
\pagestyle{empty}
\usepackage{amsmath,amssymb,stmaryrd}       
\usepackage{enumerate}   
\usepackage{environ}

\begin{document}
\let\olditem=\item
\let\oldenumerate=\enumerate
\let\endoldenumerate=\endenumerate

\newdimen\maldimen
\NewEnviron{newenumerate}[1][i)]{%
   \maldimen=0pt%
   \def\item##1: {\setbox0=\hbox{\ ##1: }%
      \ifnum\maldimen<\wd0 \global\maldimen=\wd0 \fi%
      }%
      \setbox2=\vbox{\hbox{\BODY}}%
   % an original enumerate
   \def\item##1: {\olditem {\makebox[0pt][r]{##1: }}}%     
   \oldenumerate[#1]% its begin
   %\let\oldlabelsep=\labelsep
   \labelsep=\maldimen
   \leftskip=\maldimen
   \labelwidth=\maldimen
   %\itemindent=-\maldimen
   \BODY % a set of \items...
   \endoldenumerate% its end
   %\let\item=\olditem
   }

Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. Text before. 
\begin{newenumerate}[i)]
    \item Case $\Phi < 0$: Fishing-out problem (most obvious inventions first), $\dot A_i$ decreases , with $A \uparrow$, difficulty of innovation increases with state of the art of an economy
    \item Case $\Phi  = 0$: no external effects
    \item Case $\Phi > 0$: positive external effects predominate - $\dot A_i$ increases with $A \uparrow$ - fundamental research with high spillover effects (differential calculus, electricity, semiconductors)
\end{newenumerate}

\begin{enumerate}[i)]
\item A a
\item B b
\item C c
\end{enumerate}

\end{document}

一个例子

答案2

使用盒子,它与microtype包装几乎完全贴合。

\documentclass[15pt, a4paper]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}
\usepackage{enumitem,microtype}
\newlength{\mylen}
\settowidth{\mylen}{Case $\Phi < 0$}
\newcommand{\mybox}[1]{\makebox[\mylen][l]{#1}}
\newlength{\mylenn}
\newlength{\mylenm}
\setlength{\mylenn}{\dimexpr\mylen+\labelwidth+\labelsep\relax}
\setlength{\mylenm}{\dimexpr\mylen+2\labelsep\relax}
\begin{document}

\begin{enumerate}[label= \roman*),leftmargin=\mylenn,
        itemindent=-\mylenm]
    \item \mybox{Case $\Phi < 0$}: Fishing-out problem (most obvious inventions first), $\dot A_i$ decreases , with $A \uparrow$, difficulty of innovation increases with state of the art of an economy
    \item \mybox{Case $\Phi  = 0$}: no external effects
    \item \mybox{Case $\Phi > 0$}: positive external effects predominate - $\dot A_i$ increases with $A \uparrow$ - fundamental research with high spillover effects (differential calculus, electricity, semiconductors)
\end{enumerate}
\end{document}

在此处输入图片描述

答案3

虽然列表是一种可行的方法,但在这种情况下,我个人的偏好是使用表格,再加上 的功能array.sty。只是一个建议——我不坚持——每个人都有自己的建议:

\documentclass{amsart}

\usepackage{array}

\newcounter{mystep}

\begin{document}

\renewcommand{\arraystretch}{1.5}
\begin{tabular}{@{\stepcounter{mystep}}>{\romannumeral\themystep.}r>{Case\ }l<{:}p{3in}}
&$\Phi<0$&Fishing out problem (most obvious inventions first), $\dot{A}_i$ decreases, with $A\uparrow$, difficulty of innovation increases with state of the art on an economy\\
&$\Phi=0$&No external effects\\
&$\Phi>0$& positive external effects predominate -- $\dot{A}_i$ increases with $A\uparrow$ -- fundamental research with high spillover effects (differential calculus, electricity, semiconductors)
\end{tabular}

\setcounter{mystep}{0}
\begin{tabular}{@{\stepcounter{mystep}}>{\themystep.)}l>{$}l<{$}p{3.25in}}
&\rho>0&time preference rate\\
&d(j,\omega,t)&demanded quantity of goods of quality lever $j$ of industry $\omega$ at time $t$\\
&\sum_{j=0}^{\infty}&all available quality levels $j$ of a consumer good $\omega$ can be consumed at the same time (in principle) $\rightarrow$ however: only consumption of those goods with best quality adjusted price.
\end{tabular}

\end{document}

在此处输入图片描述

答案4

对于大小相同的情况,使用 flushleft ,其余部分则使用 LaTeX 完全对齐

\documentclass[15pt, a4paper]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}       
\usepackage{enumitem}   
\begin{document}
%Note: assuming all case descriptors are of the same size, then just wrap with \flushleft{}
\begin{enumerate}
%    \item \parbox{\widthof{Case $\Phi < 0$:xxxxx}}{Case $\Phi < 0$:} Fishing-out problem (most obvious inventions first), $\dot A_i$ decreases , with $A \uparrow$, difficulty of innovation increases with state of the art of an economy
    \item \flushleft{Case $\Phi < 0$:} Fishing-out problem (most obvious inventions first), $\dot A_i$ decreases , with $A \uparrow$, difficulty of innovation increases with state of the art of an economy
    \item \flushleft{Case $\Phi = 0$:} no external effects
    \item \flushleft{Case $\Phi > 0$:} positive external effects predominate - $\dot A_i$ increases with $A \uparrow$ - fundamental research with high spillover effects (differential calculus, electricity, semiconductors)
\end{enumerate}
\end{document}

相关内容