表格里如何添加代码?

2019-11-03 08:35发布

\documentclass{article} \begin{document} \begin{tabular}{c|c} \hline name & direction \\ \hline a...

\documentclass{article} \begin{document} \begin{tabular}{c|c} \hline name & direction \\ \hline a1 & N-SL \\ \hline \end{tabular} \begin{verbatim} #include int main() { std::cout << "Hello, world!" << std::endl; return 0; } \end{verbatim} \end{document} ![怎样把代码片段放到a1的位置上?](https://pics.latexstudio.net/data/images/201911/7ba6c3da2d969e7.png "怎样把代码片段放到a1的位置上?")
2条回答
E降调
2019-11-03 09:34
可以用`p{...}`单元格: ``` \begin{tabular}{c|p{6cm}} \hline name & direction \\\hline a1 & N-SL \\\hline & \begin{verbatim} #include int main() { std::cout << "Hello, world!" << std::endl; return 0; } \end{verbatim} \end{tabular} ```

一周热门 更多>