2
A
回答
1
在tex.stackexchange给出的答案是:
\documentclass{article}
\usepackage{listings}
\renewcommand{\figurename}{Listing}
% replace figurename with the text that should preceed the caption
\begin{document}
\begin{figure}[thp] % the figure provides the caption
\centering % which should be centered
\caption{Ausgabe des C-Programms}
\begin{tabular}{c} % the tabular makes the listing as small as possible and centers it
\begin{lstlisting}[label={gtt_c_ausgabe}]
printf("Your code goes here.\n");
\end{lstlisting}
\end{tabular}
\end{figure}
\end{document}
...这仍然让我疑惑:
周围使用的代码框架,例如使用\lstset{frame=single,frameround=tttt}
,将框架方式放在右边。这怎么可以避免?
renewcommand
位做什么?
0
我没有为上市包装在我的头顶上一个答案,但你可以尝试以下方法:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\tt Hello World\\Second line}}
产生一箱为90%宽度为文本宽度的85%。
如果你想它为中心,你只是把\centering
在\tt
命令前:
\framebox[.9\linewidth]{\parbox{.85\linewidth}{\centering \tt Hello World\\Second line}}
如果你喜欢盒没有边框,简单地改变到\makebox
(并保持论据因为他们的立场) 。
相关问题
- 1. \中心环境中心的乳胶
- 2. 在列表中着色数字(乳胶)
- 3. pdflscape中的两列 - 乳胶
- 4. matlab中的乳胶字体
- 5. 列表中的乳胶脚注
- 6. 乳胶中的内容表
- 7. 胶乳序列\ /?
- 8. 在乳胶中创建符号列表
- 9. 乳胶列表:定义字体
- 10. 乳胶:在两列文章
- 11. 从乳胶文件中提取数字
- 12. 在乳胶表
- 13. 线乳胶表
- 14. 文本在数字乳胶
- 15. 乳胶文档字统计
- 16. 表中的乳胶压痕/居中
- 17. 如何在包含乳胶的表格中包含长文字?
- 18. 乳胶 - 对齐*环境中的多列
- 19. 在乳胶中的代字号
- 20. 乳胶中的字符串替换
- 21. 处理胶乳中的大数字
- 22. R图例中的乳胶表达式
- 23. 乳胶中的QED符号
- 24. 乳胶中的迭代
- 25. 乳胶中的Multiset符号
- 26. Jupyter乳胶表/表格在乳胶细胞魔术
- 27. 跳出gvim中的“主乳胶文件”
- 28. Axis中的乳胶文本/标题Octave
- 29. 使用列表修改乳胶文档中R代码的字体颜色
- 30. 带乳胶头的表格?