電子書籍の厳選無料作品が豊富!

以下のコードを実行すると、「トラ」という文字が中央に表示されます。
文字を左端に表示させるには、どうしたら良いでしょうか?



\documentclass[dvipdfmx]{jarticle}
\usepackage{graphicx}

\begin{document}

\begin{figure}[ht]
%\centering
\raggedleft
\begin{tabular}{cc}
\raisebox{-\height}{\textbf{トラ}} \\
\raisebox{-\height}{\includegraphics[height=8cm,width=9cm]{tiger.eps}} \\
\end{tabular}
\end{figure}


\end{document}

A 回答 (3件)

私なら


・画像に対して文字の位置や他の画像を重ね画きする形で自由配置に配置したい
・何らかの理由で、それを実現するようなスタイルファイルが使えない等の理由で標準機能だけで実現したい
といった時は、picture環境と組み合わせます

私の環境TeXLive2018のupLaTeXで
・jarticle.cls
・ujarticle.cls
で確認したのが末尾です
文字を配置したいのが結局左端なのか右上なのか分からないので、後者の場合です

\documentclass[dvipdfmx]{ujarticle}
% \documentclass[dvipdfmx,uplatex]{jsarticle} %jsarticle.clsをuplatexで使う場合
\usepackage{graphicx}
\usepackage{color}

\begin{document}
\begin{figure}[!htbp]
\centering
\begin{picture}(250,250)(0,0) % 最初の数字は、画像のサイズに合わせて調整する
\thicklines
\put(0,0){\includegraphics[height=8cm,width=9cm]{tiger.eps}}
\put(230,200){\textbf{トラ}}
%------------ ここから補助線 (補助線広め)-
% \thinlines
% \multiput(0,0)(10,0){31}{\textcolor{blue}{\line(0,1){300}}}
% \multiput(0,0)(0,10){31}{\textcolor{blue}{\line(1,0){300}}}
% \thicklines
% \multiput(0,0)(50,0){7}{\line(0,1){300}}
% \multiput(0,0)(0,50){7}{\line(1,0){300}}
%------------ ここまで補助線 ------------
\end{picture}
% \caption{}
% \label{}
\end{figure}

\end{document}
    • good
    • 0
この回答へのお礼

有難う御座います。

下記で出来ました。(汗)


\documentclass[dvipdfmx]{jarticle}
\usepackage{graphicx}

\begin{document}

\begin{figure}[ht]
%\centering
\raggedleft
\begin{tabular}{l}
\raisebox{-\height}{\textbf{トラ}} \\
\raisebox{-\height}{\includegraphics[height=8cm,width=9cm]{tiger.eps}} \\
\end{tabular}
\end{figure}


\end{document}

お礼日時:2018/08/25 15:08

\documentclass[dvipdfmx]{jarticle}


\usepackage[hdivide={2cm,,2cm}, vdivide={3cm,,3cm}]{geometry}
\usepackage{graphicx}
\begin{document}

\begin{figure}[ht]
%\centering
\raggedleft
\begin{tabular}{c}
\hfill \textbf{トラ} \\
\includegraphics[height=14cm,width=17cm]{tiger.eps}
\end{tabular}
\end{figure}

\end{document}
でいいんじゃないの?
    • good
    • 0
この回答へのお礼

ありがとうございました。

なぜか、左上に表示します。

お礼日時:2018/08/25 15:04

tabularで改行しているけど、必要あるの?


\documentclass[dvipdfmx]{jarticle}
\usepackage{graphicx}
\begin{document}

\begin{figure}[ht]
%\centering
\raggedleft
\begin{tabular}{cc}
\raisebox{-\height}{\textbf{トラ}} & % \\ でなく、&
\raisebox{-\height}{\includegraphics[height=8cm,width=9cm]{tiger.eps}} \\
\end{tabular}
\end{figure}


\end{document}
    • good
    • 0
この回答へのお礼

ありがとうございました。

下記のようなトラの絵が大きい場合、絵が途中で切れてしまいます。
トラの絵の右上に「トラ」と表示させることは可能でしょうか?

\documentclass[dvipdfmx]{jarticle}
\usepackage{graphicx}
\begin{document}

\begin{figure}[ht]
%\centering
\raggedleft
\begin{tabular}{cc}
\raisebox{-\height}{\textbf{トラ}} & % \\ でなく、&
\raisebox{-\height}{\includegraphics[height=14cm,width=17cm]{tiger.eps}} \\
\end{tabular}
\end{figure}


\end{document}



>tabularで改行しているけど、必要あるの?
必要ないかもしれません。

お礼日時:2018/08/24 16:51

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!